Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebSockets over a 3G connection

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 app over a 3G connection (on my iPhone, for example) then it seems like falling back to long polling is the only workable solution.

With Socket.io the connection fails with "WebSocket connection invalid or Origin not verified" before falling back to long polling.

I don't know if WebSockets are meant to work over 3G - has anyone had success getting them to work like that? I've tried a number of different methods and the all seem to fail, which makes me think that I'm attempting the impossible.

like image 605
suttree Avatar asked Apr 05 '11 20:04

suttree


People also ask

How much data can WebSocket handle?

there is not explicit limit, however it is worth nothing that for each instances (open connection) of the consumer you can only process one WS message at once.

Is there a limit on number of WebSocket connections?

The theoretical limit is 65k connections per IP address but the actual limit is often more like 20k, so we use multiple addresses to connect 20k to each (50 * 20k = 1 mil).

What are the disadvantages of WebSockets?

The biggest downside to using WebSocket is the weight of the protocol and the hardware requirements that it brings with it. WebSocket requires a TCP implementation, which may or may not be a problem, but it also requires an HTTP implementation for the initial connection setup.

Why WebSockets are not reliable?

There is no guarantee of the successful delivery of a web socket message to the peer, but if the action of sending a message causes an error known to the container, the API throws it.


1 Answers

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.

like image 68
Willy Tarreau Avatar answered Oct 02 '22 15:10

Willy Tarreau