-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
- Version: v0.11.0
- Platform: all
- Subsystem: all
var WebSocketClient = require('websocket').client;
var client = new WebSocketClient();
client.on('connectFailed', function(error) {
console.log('Connect Error: ' + error.toString());
});
client.on('connect', function(connection) {
console.log('WebSocket Client Connected');
connection.on('error', function(error) {
console.log("Connection Error: " + error.toString());
});
connection.on('close', function() {
console.log('echo-protocol Connection Closed');
});
connection.on('message', function(message) {
if (message.type === 'utf8') {
console.log("Received: '" + message.utf8Data + "'");
}
});
function sendNumber() {
if (connection.connected) {
var number = Math.round(Math.random() * 0xFFFFFF);
connection.sendUTF(number.toString());
setTimeout(sendNumber, 1000);
}
}
sendNumber();
});
client.connect('wss://echo.websocket.org', 'echo-protocol');connect error with following message:
Connect Error: Error: handshake failed {"connection":"Upgrade","date":"Thu, 12 Sep 2019 03:54:23 GMT","sec-websocket-accept":"s3pPLMBiTxaQ9kYGzzhZRbK+xOo=","server":"Kaazing Gateway","upgrade":"websocket"}Reactions are currently unavailable