在socket.io-client中,reconnect_failed事件似乎被触发了两次。我尝试过为reconnectionAttempts设置不同的值,但即使是1、2或3,它也总是触发事件两次。
若要再现方案,请在客户端运行
var opts = { reconnection: true, reconnectionAttempts: 3, reconnectionDelay: 500}
var socket = io.connect(opts)
socket.on('reconnect_failed', function() {
console.log("Reconnect failed")
})在运行杀死节点服务器(CTRL+C)时,您将在中获得以下输出:
Reconnect failed
Reconnect failedIm使用socket.io 1.0.5
发布于 2014-06-22 11:02:02
这将在下一个版本中修复。
见关于Github的答复:https://github.com/Automattic/socket.io-client/issues/705
https://stackoverflow.com/questions/24317272
复制相似问题