socket.io force a disconnect over XHR-polling

不问归期 提交于 2019-11-27 14:32:57
scanales

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

You can also get "Error: xhr poll error" if you run out of open file descriptors available. This is likely to happen during a load test.

Check the current open file descriptor size:

ulimit -n

Increase it to a high number:

ulimit -n 1000000
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!