Doc updates

This commit is contained in:
Ben Darnell 2012-01-22 17:52:43 -08:00
parent 9c3afde89e
commit e04957d535
3 changed files with 35 additions and 4 deletions

View File

@ -153,8 +153,13 @@ class WebSocketHandler(tornado.web.RequestHandler):
""" """
return None return None
def open(self, *args, **kwargs): def open(self):
"""Invoked when a new WebSocket is opened.""" """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 pass
def on_message(self, message): def on_message(self, message):
@ -206,7 +211,8 @@ class WebSocketHandler(tornado.web.RequestHandler):
"""Wrap callbacks with this if they are used on asynchronous requests. """Wrap callbacks with this if they are used on asynchronous requests.
Catches exceptions properly and closes this WebSocket if an exception 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) return self.ws_connection.async_callback(callback, *args, **kwargs)

View File

@ -12,6 +12,7 @@
.. automethod:: RequestHandler.initialize .. automethod:: RequestHandler.initialize
.. automethod:: RequestHandler.prepare .. automethod:: RequestHandler.prepare
.. automethod:: RequestHandler.on_finish
Implement any of the following methods to handle the corresponding Implement any of the following methods to handle the corresponding
HTTP method. HTTP method.

View File

@ -4,4 +4,28 @@
.. automodule:: tornado.websocket .. automodule:: tornado.websocket
.. autoclass:: WebSocketHandler .. 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