.. warning::
- The WebSocket protocol is still in development. This module currently
- implements the "hixie-76" and "hybi-10" versions of the protocol.
- See this `browser compatibility table
- <http://en.wikipedia.org/wiki/WebSockets#Browser_support>`_ on Wikipedia.
+ The WebSocket protocol is still in development. This module
+ currently implements the "hixie-76", "hybi-10", and "hybi-17"
+ versions of the protocol. See this `browser compatibility table
+ <http://en.wikipedia.org/wiki/WebSockets#Browser_support>`_ on
+ Wikipedia.
"""
# Author: Jacob Kristhammar, 2010
See http://dev.w3.org/html5/websockets/ for details on the
JavaScript interface. This implement the protocol as specified at
+ http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-17
+ The older protocol versions specified at
http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-10
- The older protocol version specified at
+ and
http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76.
- is also supported.
+ are also supported.
Here is an example Web Socket handler that echos back all received messages
back to the client::
self.open_args = args
self.open_kwargs = kwargs
- if (self.request.headers.get("Sec-WebSocket-Version") == "8" or
- self.request.headers.get("Sec-WebSocket-Version") == "7"):
+ # The difference between version 8 and 13 is that in 8 the
+ # client sends a "Sec-Websocket-Origin" header and in 13 it's
+ # simply "Origin".
+ if self.request.headers.get("Sec-WebSocket-Version") in ("7", "8", "13"):
self.ws_connection = WebSocketProtocol8(self)
self.ws_connection.accept_connection()