I\'ve been playing with Socket.io, node.js and WebSockets, all of which I can get working fine over a wifi connection.
However, when I test out a WebSocket-enabled a
As Willy Tarreau says, it's broken transparent proxies used by the mobile operators. I'm sure it's not exclusive to them either (corporate company firewalls for example). You can get around this by using a different port number (on the mobile operators at least). Something other than port 80. Using SSL might also work, but I have not tried it yet.
Then you will run into problems with folk behind firewalls blocking everything outside ports 80 & 443.
Write your websockets app to flip between port 80, and some other port on each connection attempt, and have your host listen on those two ports. Then you have a good chance of connecting to the server. Use iptables port REDIRECT if your using linux to listen to two ports simultaneously.
Some mobile phone operators are notoriously known for setting up utterly broken transparent proxies that you're forced to pass through. This is a real annoyance that the WebSocket working group has had to deal with since the very beginning. The protocol is designed to ensure that it will fail very quickly in presence of such products so that your application can immediately fall back to other methods. If you find that it takes a long time to detect the anomaly and fall back, please report it to the hybi working group at the IETF so that the issue can be diagnosed and addressed.
In parallel, you can contact your mobile phone operator and ask them how you can access the net without passing through their broken transparent proxies or at least to know when they expect to get their broken proxies fixed to support HTTP according to specifications. Some of them might offer you multiple access options.
You can use Server-Sent Events protocol instead of WebSockets.
SSE is a simpler, HTTP-compatible and can go through proxies.
Had these same errors with a bad web socket connection over certain mobile networks. Solved them by;
Moving ports: Moving over server and client for websocket over to the SSL port (port 443)
Ping keep-alive: Sending periodic "ping" messages from client to server every X seconds, and waiting for a "pong" to return from server. If server doesn't give "pong" back within Y seconds, restart the connection on client.
Implementing (1) will get you most of the way there.