From: Ben Darnell Date: Mon, 23 Jan 2012 01:52:43 +0000 (-0800) Subject: Doc updates X-Git-Tag: v2.2.0~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e04957d535b81f1fbc31ff605cc9fca47a62b3b7;p=thirdparty%2Ftornado.git Doc updates --- diff --git a/tornado/websocket.py b/tornado/websocket.py index 273dbc183..8aa777716 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 266ababab..55d69a2a6 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 7da05071f..be7bbc542 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