在EC2中运行时,我遇到socket.io(websocket
)的问题。我没有在节点实例的前面安装任何http代理或loadbalancer。在本地环境中运行时,相同的代码可以正常工作,但在EC2中保持重新连接。即使在EC2实例中,xhr-polling
也能正常工作。
当传输设置为websocket
和xhr-polling
时,以下是socket.io调试日志输出。
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