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 ?

Upvotes: 4

Views: 9923

Answers (3)

Roger F. Gay
Roger F. Gay

Reputation: 1961

Firefox 7 supports hybi-10 "straight out of the box." I've been running it against my Firefox 7 supports hybi-10 "straight out of the box." I've been running it against my websocket server. You can try my online demo with Firefox 7 and let me know if you have any problem. I've tested it from Ubuntu 11. I have that set up right now.

Upvotes: 2

kanaka
kanaka

Reputation: 73091

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.

Upvotes: 6

Related Questions