"""
return None
- def open(self, *args, **kwargs):
- """Invoked when a new WebSocket is opened."""
+ def open(self):
+ """Invoked when a new WebSocket is opened.
+
+ The arguments to `open` are extracted from the `tornado.web.URLSpec`
+ regular expression, just like the arguments to
+ `tornado.web.RequestHandler.get`.
+ """
pass
def on_message(self, message):
"""Wrap callbacks with this if they are used on asynchronous requests.
Catches exceptions properly and closes this WebSocket if an exception
- is uncaught.
+ is uncaught. (Note that this is usually unnecessary thanks to
+ `tornado.stack_context`)
"""
return self.ws_connection.async_callback(callback, *args, **kwargs)
.. automethod:: RequestHandler.initialize
.. automethod:: RequestHandler.prepare
+ .. automethod:: RequestHandler.on_finish
Implement any of the following methods to handle the corresponding
HTTP method.
.. automodule:: tornado.websocket
.. autoclass:: WebSocketHandler
- :members:
+
+ Event handlers
+ --------------
+
+ .. automethod:: WebSocketHandler.open
+ .. automethod:: WebSocketHandler.on_message
+ .. automethod:: WebSocketHandler.on_close
+ .. automethod:: WebSocketHandler.select_subprotocol
+
+ Output
+ ------
+
+ .. automethod:: WebSocketHandler.write_message
+ .. automethod:: WebSocketHandler.close
+
+ Configuration
+ -------------
+
+ .. automethod:: WebSocketHandler.allow_draft76
+ .. automethod:: WebSocketHandler.get_websocket_scheme
+
+ Other
+ -----
+
+ .. automethod:: WebSocketHandler.async_callback