1

I am using JavaScript to connect to a websocket.

I am seeing an error message in the JavaScript console of google Chrome 33.0.1750.117.

The error occurs on the following line of JavaScript:

ws = new WebSocket("ws://*.*.*.*", "sub_protocol");

This is the error being displayed:

error WebSocket extension "x-webkit-deflate-frame" is deprecated.

The server side is using libwebsockets with the C programming language.

----- Update -----

I have been looking around and found a way to view the WebSocket frames in google Chrome. If you go to chrome://net-internals/ and then click on Sockets and then click on the link to View live sockets. You will see all the currently connected websocket connections.

t=1394662462152 [st=1]   -SOCKET_STREAM_CONNECT
t=1394662462153 [st=2]    WEB_SOCKET_SEND_REQUEST_HEADERS
    --> GET / HTTP/1.1
        Upgrade: websocket
        Connection: Upgrade
        Host: *.*.*.*:**
        Origin: http://localhost
        Sec-WebSocket-Protocol: sub_protocol
        Pragma: no-cache
        Cache-Control: no-cache
        Sec-WebSocket-Key: 98P9cdkKOc5ouQOvgUHiJQ==
        Sec-WebSocket-Version: 13
        Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits, x-webkit-deflate-frame
        User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.149 Safari/537.36
        Cookie: [63 bytes were stripped]


t=1394662462153 [st=2]    SOCKET_STREAM_SENT
t=1394662462157 [st=6]    SOCKET_STREAM_RECEIVED
t=1394662462157 [st=6]    WEB_SOCKET_READ_RESPONSE_HEADERS
--> HTTP/1.1 101 Switching Protocols
    Upgrade: WebSocket
    Connection: Upgrade
    Sec-WebSocket-Accept: I/gi7/zdRzUKT9DwGS5xWBsmak0=
    Sec-WebSocket-Protocol: sub_protocol
    Sec-WebSocket-Extensions: x-webkit-deflate-frame

What is causing this error to occur in Google Chrome?

How can I get rid of the error message and use a non-deprecated WebSocket Extension?

BrightIntelDusk
  • 4,577
  • 2
  • 25
  • 34
  • 1
    What do you use the second argument, "sub_protocol" for? AFAIK, "x-webkit-deflate-frame" is a now deprecated WebSocket subprotocol, which has now been replaced with per-message-deflate. – gzost Mar 01 '14 at 10:47
  • Our course the W3C has defined the. [interface for web sockets]( http://www.w3.org/TR/2011/WD-websockets-20110419/#websocket) as having a constructor that receives a sub protocol as the second parameter. Though it is optional and not required. Now that you mention it I might actually not even need to have that set. Would passing in a sub protocol influence the connectivity if no sub protocol is defined on the server side? Also is that the reason I am seeing the error message in Google chrome? – BrightIntelDusk Mar 01 '14 at 15:25
  • 2
    If you do not actually use a specific WebSocket subprotocol, then you should not pass a parameter. If you pass the parameter, then this should be a valid subprotocol which the server supports. 'sub_protocol' is not a valid suprotocol (for a list of registered ones, see https://www.iana.org/assignments/websocket/websocket.xml). My best guess is that in some client/server combinations, this gets ignored, while Chrome processes it in a way that leads to your observed error. – gzost Mar 02 '14 at 12:39
  • I've removed the sub protocol and I am still receiving the error in Google Chrome. Is it possible that it could be something in the websocket header received from the server that is causing the error? – BrightIntelDusk Mar 03 '14 at 19:13
  • Pure guesswork now, but that sounds plausible, i.e. that the server tries to negotiate the old, proprietary deflate protocol which is no longer supported by Chrome. – gzost Mar 04 '14 at 10:31

0 Answers0