socket.io icon indicating copy to clipboard operation
socket.io copied to clipboard

Http instead of Ws protocol

Open iamdriz opened this issue 11 years ago • 2 comments

According to the docs: http://socket.io/docs/

You set the protocol to http e.g. var socket = io('http://localhost');

But should it not be ws e.g. var socket = io('ws://localhost');

iamdriz avatar Jul 21 '15 14:07 iamdriz

as far as i know. you should be able to use 'ws' if you want. The only reason I can think is that 'ws' is not supported in all browser. But the major browser like chrome, firefox, opera, safari has support for it.

sasankh avatar Jul 21 '15 17:07 sasankh

As far as I know, socket.io has fallbacks for cases where sockets are not supported out of the box. Hence, we use http:// instead of ws:// On 21 Jul 2015 23:11, "Sasankh" [email protected] wrote:

as far as i know. you should be able to use 'ws' if you want. The only reason I can think is that 'ws' is not supported in all browser. But the major browser like chrome, firefox, opera, safari has support for it.

— Reply to this email directly or view it on GitHub https://github.com/Automattic/socket.io/issues/2180#issuecomment-123412280 .

maxzeroedge avatar Jul 21 '15 18:07 maxzeroedge