From e04957d535b81f1fbc31ff605cc9fca47a62b3b7 Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Sun, 22 Jan 2012 17:52:43 -0800 Subject: [PATCH] Doc updates --- tornado/websocket.py | 12 +++++++++--- website/sphinx/web.rst | 1 + website/sphinx/websocket.rst | 26 +++++++++++++++++++++++++- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/tornado/websocket.py b/tornado/websocket.py index 273dbc18..8aa77771 100644 --- a/tornado/websocket.py +++ b/tornado/websocket.py @@ -153,8 +153,13 @@ class WebSocketHandler(tornado.web.RequestHandler): """ 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): @@ -206,7 +211,8 @@ class WebSocketHandler(tornado.web.RequestHandler): """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) diff --git a/website/sphinx/web.rst b/website/sphinx/web.rst index 266ababa..55d69a2a 100644 --- a/website/sphinx/web.rst +++ b/website/sphinx/web.rst @@ -12,6 +12,7 @@ .. automethod:: RequestHandler.initialize .. automethod:: RequestHandler.prepare + .. automethod:: RequestHandler.on_finish Implement any of the following methods to handle the corresponding HTTP method. diff --git a/website/sphinx/websocket.rst b/website/sphinx/websocket.rst index 7da05071..be7bbc54 100644 --- a/website/sphinx/websocket.rst +++ b/website/sphinx/websocket.rst @@ -4,4 +4,28 @@ .. 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