websocket
在 EC2 中运行时,我遇到了 socket.io ( ) 的问题。我没有在节点实例前面安装任何 http 代理或负载平衡器。在本地环境中运行时,相同的代码工作正常,但在 EC2 中继续重新连接。即使在 EC2 实例中也xhr-polling
可以正常工作。
以下是 transport 设置为websocket
and时的 socket.io 调试日志输出xhr-polling
。
debug - discarding transport
debug - authorized
info - handshake authorized aoiP_6qFnqiqEC3r2-0N
debug - setting request GET /socket.io/1/websocket/aoiP_6qFnqiqEC3r2-0N
debug - set heartbeat interval for client aoiP_6qFnqiqEC3r2-0N
debug - client authorized for
debug - websocket writing 1::
warn - websocket parser error: reserved fields must be empty
info - transport end (undefined)
debug - set close timeout for client NxkBCtJqwOscfHzE0xba
debug - cleared close timeout for client NxkBCtJqwOscfHzE0xba
debug - cleared heartbeat interval for client NxkBCtJqwOscfHzE0xba