]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Update release notes and docs.
authorBen Darnell <ben@bendarnell.com>
Sat, 24 Jan 2015 23:18:09 +0000 (18:18 -0500)
committerBen Darnell <ben@bendarnell.com>
Sat, 24 Jan 2015 23:18:09 +0000 (18:18 -0500)
docs/gen.rst
docs/releases/next.rst
tornado/websocket.py

index e9a7e5c53841813bb8ebcfa6f5f27effd67206be..c9d1cc851bc7637f35129621ec172d9c9389d655 100644 (file)
 
    .. autofunction:: maybe_future
 
+   .. autofunction:: sleep
+
    .. autodata:: moment
       :annotation:
 
    .. autofunction:: Task
 
+   .. autoclass:: WaitIterator
+
    .. class:: Arguments
 
       The result of a `Task` or `Wait` whose callback had more than one
index 9c03893e67de6c0093a0891e708a3e8e6035754f..751aec580cdba6ba01451b24f81a29baff7e5be6 100644 (file)
@@ -87,3 +87,26 @@ In progress
 * Malformed ``multipart/form-data`` bodies will always be logged
   quietly instead of raising an unhandled exception; previously
   the behavior was inconsistent depending on the exact error.
+* `.websocket_connect` now has a ``on_message_callback`` keyword argument
+  for callback-style use without ``read_message()``.
+* New class `tornado.gen.WaitIterator` provides a way to iterate
+  over ``Futures`` in the order they resolve.
+* When a new `.IOLoop` is created, it automatically becomes "current"
+  for the thread if there is not already a current instance.
+* When the `~functools.singledispatch` library is available (standard on
+  Python 3.4, available via ``pip install singledispatch`` on older versions),
+  the `.convert_yielded` function can be used to make other kinds of objects
+  yieldable in coroutines.
+* It is now possible to yield ``asyncio.Future`` objects in coroutines
+  when the `~functools.singledispatch` library is available and
+  ``tornado.platform.asyncio`` has been imported.
+* It is now possible to yield ``Deferred`` objects in coroutines
+  when the `~functools.singledispatch` library is available and
+  ``tornado.platform.twisted`` has been imported.
+* New methods `tornado.platform.asyncio.to_tornado_future` and
+  `~tornado.platform.asyncio.to_asyncio_future` convert between
+  the two libraries' `.Future` classes.
+* New function `tornado.gen.sleep` is a coroutine-friendly
+  analogue to `time.sleep`.
+* ``tornado.curl_httpclient`` now uses its own logger for debug output
+  so it can be filtered more easily.
index ccf80f46645c906132ef5b58545b6ccb99e4d3a7..c009225ce51decfd59ea964855648cbe10babe92 100644 (file)
@@ -1000,11 +1000,26 @@ def websocket_connect(url, io_loop=None, callback=None, connect_timeout=None,
     ``compression_options`` is interpreted in the same way as the
     return value of `.WebSocketHandler.get_compression_options`.
 
+    The connection supports two styles of operation. In the coroutine
+    style, the application typically calls
+    `~.WebSocketClientConnection.read_message` in a loop::
+
+        conn = yield websocket_connection(loop)
+        while True:
+            msg = yield conn.read_message()
+            if msg is None: break
+            # Do something with msg
+
+    In the callback style, pass an ``on_message_callback`` to
+    ``websocket_connect``. In both styles, a message of ``None``
+    indicates that the connection has been closed.
+
     .. versionchanged:: 3.2
        Also accepts ``HTTPRequest`` objects in place of urls.
 
     .. versionchanged:: 4.1
-       Added ``compression_options``. The ``io_loop`` argument is deprecated.
+       Added ``compression_options`` and ``on_message_callback``.
+       The ``io_loop`` argument is deprecated.
     """
     if io_loop is None:
         io_loop = IOLoop.current()