我已经在端口 3000 上运行了一个 socket.io 服务器,运行良好。所有 socket.emit 和其他操作都通过 websocket 连接工作。
但是,一旦我尝试在端口 80 上运行服务器,更改
app.listen(3000) to app.listen(80)
并进行了所有必要的客户端更改,socket.io 停止使用 websocket 并切换到 xhr 轮询
warn - websocket connection invalid
info - transport end
debug - set close timeout for client 1830609591747620770
debug - cleared close timeout for client 1830609591747620770
debug - cleared heartbeat interval for client 1830609591747620770
debug - setting request GET /socket.io/1/websocket/1830609591747620770
debug - set heartbeat interval for client 1830609591747620770
warn - websocket connection invalid
info - transport end
debug - set close timeout for client 1830609591747620770
debug - cleared close timeout for client 1830609591747620770
debug - cleared heartbeat interval for client 1830609591747620770
debug - setting request GET /socket.io/1/xhr-polling/1830609591747620770?t=1338511205390
debug - setting poll timeout
debug - client authorized for
debug - clearing poll timeout
debug - xhr-polling writing 1::
debug - set close timeout for client 1830609591747620770
debug - setting request GET /socket.io/1/xhr-polling/1830609591747620770?t=1338511205500
debug - setting poll timeout
debug - discarding transport
关于为什么它切换到 xhr 轮询以及我可以尝试什么的任何想法?
谢谢
编辑:: 我也在运行快速网络服务器和网络套接字服务器这一事实是否会成为问题?因为在我的代码中,我已经启动并运行了。如果这导致了问题,我该如何解决这个问题?