某些网络中的 Socket.io 错误
我在某些网络中使用 socket.io 时遇到问题。
我用来测试这个的演示页面和节点服务器最初是在 此处和此处 。它是socket.io提供的一个简单的聊天客户端。
当用户从某些封闭网络(例如办公室或大学)访问我的服务器上的此演示页面时,用户会反复连接和断开连接,直到最终断开连接。在此期间 Node.js 的输出是:
3 May 07:50:41 - Initializing client with transport "jsonp-polling"
3 May 07:50:41 - Client 16640139906667173 connected
3 May 07:50:41 - Initializing client with transport "jsonp-polling"
3 May 07:50:41 - Client 6106549079995602 connected
3 May 07:50:41 - Initializing client with transport "jsonp-polling"
3 May 07:50:41 - Client 8987158865202218 connected
3 May 07:50:42 - Initializing client with transport "jsonp-polling"
3 May 07:50:49 - Client 16640139906667173 disconnected
3 May 07:50:49 - Client 8987158865202218 disconnected
3 May 07:50:49 - Client 6106549079995602 disconnected
这将持续到浏览器放弃并永久断开连接。
以前有人遇到过类似的问题吗?什么可能导致 socket.io 在特定网络内失败?
谢谢。
I am experiencing problems using socket.io from within certain networks.
The demo page and node server I am using to test this are originally found here and here. It is a simple chat client provided by socket.io.
When a user accesses this demo page on my server from within certain closed networks such as an office or university, the user connects and disconnects repeatedly until it finally drops the connection. The output from Node.js during this is:
3 May 07:50:41 - Initializing client with transport "jsonp-polling"
3 May 07:50:41 - Client 16640139906667173 connected
3 May 07:50:41 - Initializing client with transport "jsonp-polling"
3 May 07:50:41 - Client 6106549079995602 connected
3 May 07:50:41 - Initializing client with transport "jsonp-polling"
3 May 07:50:41 - Client 8987158865202218 connected
3 May 07:50:42 - Initializing client with transport "jsonp-polling"
3 May 07:50:49 - Client 16640139906667173 disconnected
3 May 07:50:49 - Client 8987158865202218 disconnected
3 May 07:50:49 - Client 6106549079995602 disconnected
This continues until the browser gives up and permanently drops the connection.
Has anyone experienced similar issues before? What could cause socket.io to fail from within specific networks?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
某些办公室/大学网络会过滤掉高于已知端口阈值 (1024+) 的端口。这可以防止用户使用 P2P 软件(包括 8080)并减少网络堵塞。我建议将聊天客户端端口更改为该范围内的端口或众所周知的端口,可能我的选择是 81-90。
Some office/university networks filter out ports above the well-known port threshold (1024+). This prevents users from using P2P software (which includes 8080) and provides a less clogged network. I would suggest changing the chat client port to something within that range or something well known, possibly 81-90 would be my choice.