-->

Socket IO fails to connect within corporate networ

2020-08-01 06:44发布

问题:

I am just getting to grips with socket.IO and nodeJS. Got my web app working ok with them. I then got a friend to try it out at work on an office machine and found that it failed to connect.

I set up these two test cases:

http://thebeer.co/labs/rt/chat.php (server JS here) - This is an exact copy of the socket.IO chat example.

http://thebeer.co/labs/rt/test.php (server JS here)

Both of them fail for him. I also got a friend to try on a University computer and that too failed to connect! I've tried node servers listening on ports 8100, 8080, and 81-90 after being told that lower port numbers are less likely to be blocked by secure networks.

Really don't understand, it is very important that that real-time functionality is accessible to everyone, what am I doing wrong?

How can I get socket.IO to connect within secure Office and University networks?

回答1:

A lot of big corporate networks will block everything other than port 80 (http) and port 443 (https) for most of their users. Try and put everything over one of those two for maximum compatibility.



回答2:

Even when you get the everything running on port 80, also keep in mind that a lot enterprisey networks run HTTP traffic through content filters or other proxies that might not understand the websockets Upgrade header... you might want to try forcing socket.io to use one of the background compatibility transports and see if that helps.

FWIW, +1 to Colin Pickard because he is probably right... I just thought I would add this point just in case.



回答3:

Take a look at both these links. I helped another so member who wanted the same.

I'm running nodejs on port 80 and I have no issues with corporate networks. (One thing I needed to have working as a priority)

How do I run Node.js on port 80?

https://serverfault.com/questions/273143/binding-apache-to-specific-ip-address/273181#273181