[sr-dev] WebSockets broken?

Peter Dunkley peter.dunkley at crocodile-rcs.com
Thu May 30 18:17:57 CEST 2013


When latest Kamailio git master sends a message over WebSocket 
(specifically an MSRP reply on my test system) I get the error,

    One or more reserved bits are on: reserved1 = 1, reserved2 = 0, reserved3 = 0

in Google Chrome.  This happens for WebSockets over TCP and WebSockets 
over TLS.  It doesn't happen with a build of Kamailio git master from 
around two weeks ago.

Have there been any changes in the network code over the last couple of 
weeks that might have had an effect on what Kamailio puts out on the 
wire for TCP and TLS?

The code to send an MSRP reply over WebSocket is in 
modules/msrp/msrp_netio.c:msrp_reply()

         if (unlikely((env->srcinfo.proto == PROTO_WS
                         || env->srcinfo.proto == PROTO_WSS)
                         && sr_event_enabled(SREV_TCP_WS_FRAME_OUT))) {
                 struct tcp_connection *con = tcpconn_get(env->srcinfo.id, 0, 0,
                                                                 0, 0);
                 ws_event_info_t wsev;

                 if (con == NULL)
                 {
                         LM_WARN("TCP/TLS connection for WebSocket could not be"
                                 "found\n");
                         return -1;
                 }

                 memset(&wsev, 0, sizeof(ws_event_info_t));
                 wsev.type = SREV_TCP_WS_FRAME_OUT;
                 wsev.buf = rplbuf;
                 wsev.len = p - rplbuf;
                 wsev.id = con->id;
                 return sr_event_exec(SREV_TCP_WS_FRAME_OUT, (void *) &wsev);
         }


The code that handles the SREV_TCP_WS_FRAME_OUT event is in 
modules/websocket/ws_frame.c and basically involves:

  * filling in the WebSocket message header
  * identifying the correct TCP/TLS connection
  * setting some flags (for example, SND_F_FORCE_CON_REUSE)
  * calling tcp_send()

These areas of the code haven't been changed for months.

Regards,

Peter


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20130530/ba4aa126/attachment.html>


More information about the sr-dev mailing list