txWebSocket icon indicating copy to clipboard operation
txWebSocket copied to clipboard

Support 0xFF frames and closing handshakes

Open wulczer opened this issue 13 years ago • 0 comments

As specified in http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76#section-4.2 WebSocket frames can also be of type 0xFF, with a length specification followed by arbitrary data, that the server should discard. The first commit implements parsing this type of frames. The parsing process has been overhauled by using twisted.web._newclient.makeStatefulDispatch, so it introduces a dependency on Twisted 9.0.0 (I hope it's OK, if not it's easy to do the dispatch by hand).

The second commit implements the closing handshake that can be initiated by the client, as described in http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76#section-1.4. Without this, closing the browser while it's connected to the WebSocket server results in a traceback in the server log (this happens both with Chrome and Firefox native WebSockets and with web-socket-js).

wulczer avatar May 15 '11 19:05 wulczer