防止';心跳超时';带WebSocket和SocketIO
我使用NodeJS和SocketIO作为我的websocket解决方案。它工作正常,但几分钟后,我的套接字服务器总是超时,控制台中显示以下消息:防止';心跳超时';带WebSocket和SocketIO,websocket,socket.io,connection-timeout,Websocket,Socket.io,Connection Timeout,我使用NodeJS和SocketIO作为我的websocket解决方案。它工作正常,但几分钟后,我的套接字服务器总是超时,控制台中显示以下消息: debug - fired heartbeat timeout for client info - transport end <heartbeat timeout> debug - set close timeout for client debug - cleared close timeout for client debug - d
debug - fired heartbeat timeout for client
info - transport end <heartbeat timeout>
debug - set close timeout for client
debug - cleared close timeout for client
debug - discarding transport
如何防止超时发生 查看关闭超时和心跳超时选项 您可以通过以下方式在服务器上以编程方式进行设置:
var io = require('socket.io').listen(80);
io.set('close timeout', 60);
io.set('heartbeat timeout', 60);
至于应用程序的设计,您应该检查是否应该更改超时的问题
var io = require('socket.io').listen(80);
io.set('close timeout', 60);
io.set('heartbeat timeout', 60);