WebSockets allow for bidirectional
communication between the browser and server.

Warning

The WebSocket protocol is still in development. This module currently
implements the “draft76” version of the protocol, which is supported
only by Chrome and Safari. See this browser compatibility table on Wikipedia.

Web Sockets are not standard HTTP connections. The “handshake” is HTTP,
but after the handshake, the protocol is message-based. Consequently,
most of the Tornado HTTP facilities are not available in handlers of this
type. The only communication methods available to you are write_message()
and close(). Likewise, your request handler class should
implement open() method rather than get() or post().

If you map the handler above to “/websocket” in your application, you can
invoke it in JavaScript with: