socket.io force a disconnect over XHR-polling

后端 未结 2 864
没有蜡笔的小新
没有蜡笔的小新 2020-12-03 13:16

I have a client/server application using nodejs on the server and socket.io as the connection mechanism. For reasons relevant to my application I want to have only one activ

2条回答
  •  长情又很酷
    2020-12-03 13:33

    Solved the issue, it turns out it was a bug introduced in socket.io 0.9.5. If you have this issue just update BOTH your server and client-side code to socket.io > 0.9.9 and set the socket.io client-side options sync disconnect on unload to true and you're all set.

    Options are set this way:

    var socket = io.connect('http://yourdomain.com', {'sync disconnect on unload' : true});
    

提交回复
热议问题