[Libwebsockets] Problems with the ietf Version

Andy Green andy at warmcat.com
Thu Feb 21 17:13:04 CET 2013

Hi -

The support for -76 protocol has been removed, along with the other pre-standardized variants like 04 and 05.  All we support now is 13, because that's what actually went into the standard: all the modern browsers took the same approach.  A lot of fiddly untested and unmaintainable code came out with that, I don't plan on putting it back in.

However if you're sending 5k+ packets it makes sense to increase the frame buffer to 6K.  You can do that with a new parameter in struct libwebsocket_protocols, 0 there defaults to a 4k frame buffer.


Steve Hegenbart <steve.hegenbart at gmx.de> wrote:

>Dear Andy,
>i just updated from Version 0.1 to Version 1.2 (actually that took me a
>bit of time getting everything to work).
>Sadly, my websocket connection won't work like it should with the
>ietf Version.
>With the old sources, i've choosen version 0, which made a connection
>two websocket keys and worked properly (i needed that based on the
>connection). The connection is still working anyway, yet i'm sending my
>packages to the server (most likely 5464 bytes data packages, based on 
>4096 bytes packages encoded to base64) and getting a response for
>UTF-8 from the server after some time.
>Question 1:
>Is there a possibility to change back to the Sec-WebSocket-Key1 /  
>Sec-WebSocket-Key2 version?
>Question 2:
>Is there anything that changed and i do have to care about for the  
>encoding formats of the websocket? I just changed from the old code to
>new one by generating the lws_context_creation_info struct with the old
>values. Now i've already seen to care for the 4096 buffer size
>and i am not sure what to check out for. Nevertheless, i will check
>what i  
>could change for the moment.
>Here some stuff send by the old and the new libraries and the changed
>*** libwebsockets 0.1:
>GET /webSocket/WebSocketAudioServlet HTTP/1.1
>Host: XX.XX.XX.XX
>Connection: Upgrade
>Sec-WebSocket-Key2: < 1Z 5w 680, 31m0\ 6=5
>Upgrade: WebSocket
>Sec-WebSocket-Key1: 17N 1 3 l0 906 8
>Origin: http://XX.XX.XX.XX
>HTTP/1.1 101 WebSocket Protocol Handshake
>Upgrade: WebSocket
>Connection: Upgrade
>Sec-WebSocket-Origin: http://XX.XX.XX.XX
>.AUTH some_random_auth_code..OK..RECOSTART  
>{"timing":"true","lang":"de-DE"}..OK..DATA 5464  
>*** libwebsockets 2.1:
>GET /webSocket/WebSocketAudioServlet HTTP/1.1
>Pragma: no-cache
>Cache-Control: no-cache
>Host: XX.XX.XX.XXUpgrade: websocket
>Connection: Upgrade
>Sec-WebSocket-Key: 5agP9l/+ftSJtgpl1QyGFw==
>Origin: http://XX.XX.XX.XXSec-WebSocket-Protocol: ROS EML Audio
>Sec-WebSocket-Version: 13
>HTTP/1.1 101 Switching Protocols
>Upgrade: WebSocket
>Connection: Upgrade
>Sec-WebSocket-Accept: 4btSCqQbIQ2VNJwywsECpx8CgUc=
>Sec-WebSocket-Protocol: ROS EML Audio Protocol
>*** The C++ code, old code as comment
>static struct libwebsocket_protocols protocols[] = {
>    "ROS EML Audio Protocol",
>    websocket_callback,
>    0, 0, NULL, 0
>    },
>    { /* end of list */
>    NULL, NULL, 0, 0, NULL, 0
>    }
>struct lws_context_creation_info info;
>memset(&info, 0, sizeof info);
>info.protocols = protocols;
>info.gid = -1;
>info.uid = -1;
>info.extensions = NULL;
>info.options = 0;
>//if (!(_context = libwebsocket_create_context(CONTEXT_PORT_NO_LISTEN, 
>NULL, protocols, NULL, NULL, NULL, -1, -1, 0, NULL))) { // old  
>libwebsockets version
>if (!(_context = libwebsocket_create_context(&info))) {
>   _context = NULL;
>   _state = WSI_NOT_CONNECTED;
>printf("<websocket_base> ERROR: Could not create websocket context\n");
>   return false;
>Maybe you have some ideas or can append the old ietf version.
>Steve Hegenbart - Opera Browser Mail
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20130222/32c64ec6/attachment-0001.html>

More information about the Libwebsockets mailing list