socket.io 如何重新建立连接,以及断开连接
kevin.Zhu 发布于:2013-2-2 10:25 分类:Nodejs 有 17 人浏览,获得评论 0 条
v1.3.5版本。 。。 官方文档说了 可以通过 设置 ‘force new connection’: true 实现。。 reconnect() 方法报错。。
socket = io(‘http://localhost:1234’,{‘force new connection’: true}); 进行新连接设置, 再次执行 连接 就行了 。。。
http://stackoverflow.com/questions/24566847/socket-io-client-connect-disconnect
Have you tried this config in client ?
// 0.9 socket.io version
io.connect(SERVER_IP, {'force new connection': true});
// 1.0 socket.io version
io.connect(SERVER_IP, {'forceNew': true});