javascript - Error 1006 on websocket - Stack Overflow

I am getting error 1006 on my Web-socket API. I have two machines, and code works fine in one and in th

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..."); 
};

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745429566a4627331.html

相关推荐

  • javascript - Error 1006 on websocket - Stack Overflow

    I am getting error 1006 on my Web-socket API. I have two machines, and code works fine in one and in th

    11小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信