Skip to content

Commit e04957d

Browse files
committed
Doc updates
1 parent 9c3afde commit e04957d

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed

tornado/websocket.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,13 @@ def select_subprotocol(self, subprotocols):
153153
"""
154154
return None
155155

156-
def open(self, *args, **kwargs):
157-
"""Invoked when a new WebSocket is opened."""
156+
def open(self):
157+
"""Invoked when a new WebSocket is opened.
158+
159+
The arguments to `open` are extracted from the `tornado.web.URLSpec`
160+
regular expression, just like the arguments to
161+
`tornado.web.RequestHandler.get`.
162+
"""
158163
pass
159164

160165
def on_message(self, message):
@@ -206,7 +211,8 @@ def async_callback(self, callback, *args, **kwargs):
206211
"""Wrap callbacks with this if they are used on asynchronous requests.
207212
208213
Catches exceptions properly and closes this WebSocket if an exception
209-
is uncaught.
214+
is uncaught. (Note that this is usually unnecessary thanks to
215+
`tornado.stack_context`)
210216
"""
211217
return self.ws_connection.async_callback(callback, *args, **kwargs)
212218

website/sphinx/web.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
.. automethod:: RequestHandler.initialize
1414
.. automethod:: RequestHandler.prepare
15+
.. automethod:: RequestHandler.on_finish
1516

1617
Implement any of the following methods to handle the corresponding
1718
HTTP method.

website/sphinx/websocket.rst

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,28 @@
44
.. automodule:: tornado.websocket
55

66
.. autoclass:: WebSocketHandler
7-
:members:
7+
8+
Event handlers
9+
--------------
10+
11+
.. automethod:: WebSocketHandler.open
12+
.. automethod:: WebSocketHandler.on_message
13+
.. automethod:: WebSocketHandler.on_close
14+
.. automethod:: WebSocketHandler.select_subprotocol
15+
16+
Output
17+
------
18+
19+
.. automethod:: WebSocketHandler.write_message
20+
.. automethod:: WebSocketHandler.close
21+
22+
Configuration
23+
-------------
24+
25+
.. automethod:: WebSocketHandler.allow_draft76
26+
.. automethod:: WebSocketHandler.get_websocket_scheme
27+
28+
Other
29+
-----
30+
31+
.. automethod:: WebSocketHandler.async_callback

0 commit comments

Comments
 (0)