Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am going to develop an instant messaging application that runs in the browser.

What browsers support the WebSocket API?

share|improve this question
We are keeping an up-to-date list of WebSocket supporting browsers on our Java WebSocket project website: jwebsocket.org/browsers.htm – Predrag Stojadinović Mar 22 '10 at 10:51
57  
We should try to keep these answers up to date, right? I presume that's preferable to re-asking it. – dreeves Apr 22 '10 at 22:46
The best site for HTML5 and related functionality is caniuse.com – kanaka Oct 19 '10 at 22:17
5  
There's a good community wiki about HTML5 websockets: stackoverflow.com/questions/4262543/using-html-5-websockets – Enrico Pallazzo Nov 24 '10 at 7:16
1  
@meagar - I disagree. I think it should be protected as a wiki to prevent new answers, but preserve the current helpful answer. This question has over 100,000 views. – Travis J Jan 18 at 17:40
show 7 more comments

closed as too localized by meagar, LittleBobbyTables, George Stocker Jan 18 at 18:23

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

11 Answers

Client side

  • Hixie-75:
    • Chrome 4.0 + 5.0
    • Safari 5.0.0
  • HyBi-00/Hixie-76:
  • HyBi-07+:
  • HyBi-10:
    • Chrome 14.0 + 15.0
    • Firefox 7.0 + 8.0 + 9.0 + 10.0 - prefixed: MozWebSocket
    • IE 10 (from Windows 8 developer preview)
  • HyBi-17/RFC 6455
    • Chrome 16
    • Firefox 11
    • Opera 12.10 / Opera Mobile 12.1

Any browser with Flash can support WebSocket using the web-socket-js shim/polyfill.

See caniuse for the current status of WebSockets support in desktop and mobile browsers.

See the test reports from the WS testsuite included in Autobahn WebSockets for feature/protocol conformance tests.


Server side

It depends on which language you use.

In Java/Java EE:

Some other Java implementations:

In C#:

In PHP:

In Python:

In C:

In Node.js:

  • Socket.io : Socket.io also has serverside ports for Python, Java, Google GO, Rack
  • sockjs : sockjs also has serverside ports for Python, Java, Erlang and Lua
  • WebSocket-Node - Pure JavaScript Client & Server implementation of HyBi-10.

Vert.x (also known as Node.x) : A node like polyglot implementation running on a Java 7 JVM and based on Netty with :

  • Support for Ruby(JRuby), Java, Grovy, Javascript(Rhino/Nashorn), Scala, ...
  • True threading. (unlike Node.js)
  • Understands multiple network protocols out of the box including: TCP, SSL, UDP, HTTP, HTTPS, Websockets, SockJS as fallback for WebSockets

Pusher.com is a Websocket cloud service accessible through a REST API.

DotCloud cloud platform supports Websockets, and Java (Jetty Servlet Container), NodeJS, Python, Ruby, PHP and Perl programming languages.

Openshift cloud platform supports websockets, and Java (Jboss, Spring, Tomcat & Vertx), PHP (ZendServer & CodeIgniter), Ruby (ROR), Node.js, Python (Django & Flask) plateforms.

For other language implementations, see the Wikipedia article for more information.

The RFC for Websockets : RFC6455

share|improve this answer
16  
+1 for keeping it up to date. Opera will also have Websockets support in 10.70. – Sasha Chedygov Oct 29 '10 at 5:27
Right, I think they renamed Opera 10.70 in Opera 11 opera.com/browser/next – Cbe317 Oct 29 '10 at 11:31
1  
IE9 will. At the moment it is still in beta. – Tony Nov 18 '10 at 15:55
3  
@Tony: IE9 does not support WebSockets. There's experimental support available as an add-on in HTML5 Labs, but not shipped and ready. – Shog9 Mar 22 '11 at 20:54
Excellent writeup. Thanks! – Jens Roland Jun 15 '11 at 18:26
show 4 more comments

A good workaround for those browsers that don't yet have native WebSocket support is with this implementation that uses flash to provide WebSocket support to JavaScript:

http://github.com/gimite/web-socket-js

This allows you to just code to WebSocket, and for browsers that have native support it'll use that. Otherwise it falls back to using flash for the support.

share|improve this answer
hmmm, I hoped it would work, but it throws this error: "[WebSocket] bad response: HTTP/1.1 505 HTTP Version Not Supported"... I have Tomcat 7 with the WebSocketServlet on the server side... – Predrag Stojadinović Oct 29 '12 at 21:33

The latest versions of browsers have support for the WebSocket API today. Here are the common browsers that support it:

  • Apple Safari (as of v5.0.1)
  • Google Chrome (as of v6)
  • Microsoft Internet Explorer (as of v10)
  • Mozilla Firefox (as of v6 with "Moz" prefix, as of v11 without prefix)
  • Opera (as of v10.70)

If you're looking for better legacy support have a look at the "Comet" model. There are frameworks today that make its implementation simpler, such as Nitrogen. Have a look at their chat room example.

You may also want to keep an eye on Google App Engine, which with its Channel API (soon available) will support the Comet model with a Web Sockets API interface, meaning that your client-side code won't need to know whether the server is communicating via open HTTP requests or web sockets. You can probably port their interface for use with your own server architecture too.

share|improve this answer
Which technologically leading browser would that be? – Anne Aug 20 '09 at 14:00
3  
Here is information about the implementation of the Web Sockets API in Mozilla browsers: bugzilla.mozilla.org/show_bug.cgi?id=472529 And here is information about the implementation in WebKit browsers: bugs.webkit.org/show_bug.cgi?id=27490 I believe you can try these features with a nightly build of either browsers. – Blixt Aug 20 '09 at 14:16
On second thought it's very possible that you have to patch the code yourself to get the functionality. In any case, I wouldn't go about using it even for experimental web sites for another couple of months at least. – Blixt Aug 20 '09 at 14:21
Ok, so you know about the same as me then :-) – Anne Aug 20 '09 at 22:11
1  
can you provide a link to the rumor that IE 9 will support WebSockets? I've searched in depth and also have been listening for any mention of this and I've heard nothing about that. – kanaka Oct 19 '10 at 22:16

As of March 2012 from caniuse.com :

  • IE10+
  • Firefox 8+
  • Chrome 14 + enter image description here
share|improve this answer
1  
Caniuse is a great resource! – Kriem Apr 10 '12 at 8:52
+1 for the caniuse.com link. Very useful! – Brendan Scarvell Apr 5 at 5:15

Important to know:

Websocket support has been DROPPED from both Opera and Firefox 4 in December 2010 due to (general, non-browser specific) security issues:

http://hacks.mozilla.org/2010/12/websockets-disabled-in-firefox-4/

It seems the issue does not lie with websockets per se but with other Internet devices that proxy requests, and disabling websockets is just a workaround until the general issue is fixed.

Also, it seems the protocol (but not the API) is expected to change, even now e.g. Opera refers to which version of the protocol they actually implement. So even if it were turned on (where it is available at all) it is far from "production ready". This still is an experimental feature.

share|improve this answer
1  
The protocol has changed from hixie to ietf-hybi. The API is indeed static and seperately defined by the HTML5 WebSocket group. – Raynos Apr 21 '11 at 11:31

js.io implements WebSockets for most browsers, using Orbited. (however, the site is currently down).

Using js.io, you can develop your app right now using the WebSocket API. And when browser will implement WebSockets natively, you'll get more performances.

share|improve this answer

You can also use Hookbox which falls back to long-polling if websocket support is unavailable in the browser.

http://hookbox.org

http://bitshaq.com/2010/07/30/a-simple-experiment-with-hookbox/

share|improve this answer

It looks like IE 9 RC, Firefox 4 and Opera 11 don't support web sockets.

Apparently there is a security issue with it at the moment

This article http://hacks.mozilla.org/2010/12/websockets-disabled-in-firefox-4/ seems to be saying that other browsers (chrome and safari) will soon remove web sockets from their features.

But you can 'fake' a web socket using silverlight/flash as demonstrated here: http://html5labs.cloudapp.net/WebSockets/ChatDemo/wsdemo.html and https://github.com/gimite/web-socket-js

And then just wait for the browsers to catch up.

share|improve this answer

I'm afraid the only place you're going to find WebSocket support is in the trunk builds of Firefox at the moment. And as far as I know, the work there is still in progress. WebKit browsers (Safari & Chrome, for example) are just getting started on their implementations and they are not even available in the nightly builds.

share|improve this answer

Jabbers BOSH protocol seems to fit instant messaging very well. Give strophe a try with a server supporting BOSH such as ejabberd.

share|improve this answer

Opera 11 will support WebSockets based on the 76 draft, one can test it out with the current 10.70 alpha:
http://my.opera.com/desktopteam/blog/2010/10/11/websockets

share|improve this answer

protected by Perception Apr 24 at 23:17

This question is protected to prevent "thanks!", "me too!", or spam answers by new users. To answer it, you must have earned at least 10 reputation on this site.

Not the answer you're looking for? Browse other questions tagged or ask your own question.