Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

websocket: handshake failed #559

Open
qile222 opened this issue Sep 12, 2019 · 1 comment
Open

websocket: handshake failed #559

qile222 opened this issue Sep 12, 2019 · 1 comment

Comments

@qile222
Copy link
Contributor

qile222 commented Sep 12, 2019

  • 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"}
@issue-label-bot
Copy link

Issue Label Bot is not confident enough to auto-label this issue. See dashboard for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant