I am going to develop an instant messaging application that runs in the browser.
What browsers support the WebSocket API?
I am going to develop an instant messaging application that runs in the browser.
What browsers support the WebSocket API?
The latest versions of browsers have support for the WebSocket API today. Here are the common browsers that support it:
Microsoft claim that Internet Explorer 9 will have support for the WebSocket API at release. There is a public snapshot build of Opera with WebSocket support available to download, and WebSockets are promised for the 10.70 release.
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.
You can also download Kaazing Enterprise Gateway - http://www.kaazing.com
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.
Jabbers BOSH protocol seems to fit instant messaging very well. Give strophe a try with a server supporting BOSH such as ejabberd.
Currently no browser supports Web Sockets. Also, Web Sockets is two standalone specifications, and no longer part of HTML5: http://www.w3.org/TR/websockets/ and http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol
chromium now supports websockets
http://blog.chromium.org/2009/12/web-sockets-now-available-in-google.html
There is a beautiful example how to use websockets: http://armstrongonsoftware.blogspot.com/2009/12/comet-is-dead-long-live-websockets.html
Works for me in WebKit and Chrome with some minor tweaks in Joe's code.
node.js is a server side JavaScript implementation. There exist several node.js implementations of WebSocket. This allows you to have JavaScript to JavaScript communication.
http://github.com/ncr/node.ws.js
http://github.com/alexanderte/websocket-server-node.js
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.
We are keeping an up-to-date list of WebSocket supporting browsers on our Java WebSocket project website: http://jwebsocket.org/browsers.htm
My WebSockets example works with Safari and Chrome on Mac. Firefox 4 Beta can't open the connection, on Windows it sometimes work with Chrome :)
socket.io and node.js is awesome Look at my multi-rooms chat demo
You can also use Hookbox which falls back to long-polling if websocket support is unavailable in the browser.
http://bitshaq.com/2010/07/30/a-simple-experiment-with-hookbox/
The best site for HTML5 and related functionality is http://caniuse.com
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