Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are WebSockets not supported in Firefox

I'm running Firefox 7 in Ubuntu 11.04, and I noticed socket.io was falling back from web sockets to xhr-polling, so I typed WebSocket in Firefox's console, and got

[00:48:21.224] ReferenceError: WebSocket is not defined

On Google Chrome 14 I got

WebSocket
function WebSocket() { [native code] }

According to this, WebSockets is partly supported since firefox 4 and fully supported since firefox 6.

Is it only different in firefox on linux ?

like image 377
João Pinto Jerónimo Avatar asked Dec 28 '22 13:12

João Pinto Jerónimo


1 Answers

In Firefox 4/5, WebSockets support is present but disabled (activated via about:config). In Firefox 6, Mozilla enabled WebSockets by default but added the "Moz" prefix. Also, note that Firefox 6 uses the newer HyBi protocol and W3C API. Chrome added the HyBi protocol in Chrome 14 although Chrome has never used a prefix.

The protocol is effectively complete and the official first version is expected to be published in about 6 weeks (the wire format has not changed significantly in months). The API has also been quite stable for months and Chrome 14+ and Firefox 6+ basically have the same implementation of the API. For some reason Mozilla has chosen to be even more cautious than normal with WebSockets prefixing. Perhaps it is a reaction to Google not being careful enough about prefixing unstable APIs.

Unless you are interested in binary message support, specific error and close condition handling or sub-protocol selection, then the WebSockets API has been essentially the same since Chrome introduced it a couple of years ago. If you are implementing a WebSockets server then you will need to know about the various versions of the protocol which has seen significant changes in the past 2 years.

like image 164
kanaka Avatar answered Jan 06 '23 03:01

kanaka