Native WebSocket support

Topics: WebSockets
Jul 12, 2011 at 1:44 AM

Can I use the native implementation of HTML5 WebSockets in a client?

var conn = new WebSocket('ws://localhost:4502/chat');

instead of

var conn = new WebSocketDraft('ws://localhost:4502/chat'));


Jul 12, 2011 at 4:40 PM

Right now it is hard to do, because the protocol specification is still in draft.

I take it you are using the prototype from the HTML5 labs website? If you are using the latest version of the prototype then the client (the WebSocketDraft object in this case) is speaking the hybi-09 version of the protocol. Currently, none of the browsers implement hybi-09. 

If you wanted to use native websockets today, you would have to figure out which versions of which browsers you were interested in supporting, then find out which versions of the WebSocket protocol they use and then find a WebSocket server that implements those versions. 

Jul 13, 2011 at 3:03 PM

Thanks Paul.

Regarding the prototype from the HTML5 labs website, current version contains a WCF binding implementation for webSockets hybi-09 version...

Is available for download the WCF server side binding implementation that uses the version -00 of the protocol (aka -76)? Opera, Chrome, Firefox and Safari are using this webSockets version.

Jul 13, 2011 at 5:10 PM

The short answer is no. The protocol has moved on a great deal since the -76 version and HTML5 labs is focused on providing an implementation that is current with the most recent specification.