admin管理员组

文章数量:1426035

I am getting error 1006 on my Web-socket API. I have two machines, and code works fine in one and in the second one I get 1006 error when I send a message from my back-end server.

Here is my code:

var ws = new WebSocket("ws://localhost:8080/handler");

ws.onopen = function()
{
  ws.send("Message send");
  alert("Connection success...");
};

ws.onmessage = function (evt) 
{ 
  var received_msg = JSON.parse(evt.data);
};

ws.onerror = function(e){};

ws.onclose = function(er)
{ 
  alert("Connection is closed..."); 
};

本文标签: javascriptError 1006 on websocketStack Overflow