Subject: [hybi] libwebsockets C library updated to 04

From: Andy Green <[email-masked]>
Date: Sun, 23 Jan 2011 21:54:35 +0000

Hi -

The libwebsockets C library now supports the 04 protocol.

http://git.warmcat.com/cgi-bin/cgit/libwebsockets/

For server mode sockets it supports 76/00 and 04 dynamically 
per-connection depending on what was sent from the client.  The 
application using the library can send a single packet to multiple 
clients which are using a mixture of protocol levels without having to 
deal with any detail.

It now also supports sockets being opened in client mode integrated into 
the same polling loop as sockets we are serving to.  When it is making a 
connection to another websocket server, it always uses 04 protocol. 
(SSL isn't supported yet on client mode sockets; it is supported for 
server mode sockets.)

I don't have an 04 browser implementation to test it against so I tested 
it against itself since it supports both client and server and that is 
working well.  Maybe it can serve as a test for others.

In the supplied example applications using the library there is a server 
app that provides both html and then two websocket connections using 
different protocols:

http://git.warmcat.com/cgi-bin/cgit/libwebsockets/tree/test-server/test-server.c

and a client app which also opens two websockets with different 
protocols to the server and does things that can be seen in a browser 
also connected to the same server

http://git.warmcat.com/cgi-bin/cgit/libwebsockets/tree/test-server/test-client.c

-Andy