Skip to content

Commit

Permalink
Update CHANGES, CONTRIBUTORS and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Aug 25, 2016
1 parent 568c074 commit 81fbd19
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ CHANGES

- Implement proxy support for ClientSession.ws_connect #1025

- Return named tuple from WebSocketResponse.can_prepare #1016


0.22.5 (08-02-2016)
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Dmitry Trofimov
Dmytro Kuznetsov
Dustin J. Mitchell
Elizabeth Leddy
Enrique Saez
Erich Healy
Eugene Chernyshov
Eugene Naydenov
Expand Down
41 changes: 35 additions & 6 deletions docs/web_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -755,12 +755,15 @@ WebSocketResponse
:param aiohttp.web.Request request: HTTP request object, that the
response answers.

:return: ``namedtuple(ok, protocol)``, *namedtuple.ok* is ``True`` on
success, *namedtuple.protocol* is websocket subprotocol which
is passed by client and accepted by server (one of *protocols*
sequence from :class:`WebSocketResponse` ctor).
*namedtuple.protocol* may be ``None`` if client and server
subprotocols are not overlapping.
:return: :class:`WebSocketReady` instance.

:attr:`WebSocketReady.ok` is
``True`` on success, :attr:`WebSocketReady.protocol` is
websocket subprotocol which is passed by client and
accepted by server (one of *protocols* sequence from
:class:`WebSocketResponse` ctor).
:attr:`WebSocketReady.protocol` may be ``None`` if
client and server subprotocols are not overlapping.

.. note:: The method never raises exception.

Expand Down Expand Up @@ -948,6 +951,32 @@ WebSocketResponse
.. seealso:: :ref:`WebSockets handling<aiohttp-web-websockets>`


WebSocketReady
^^^^^^^^^^^^^^

.. class:: WebSocketReady

A named tuple for returning result from
:meth:`WebSocketResponse.can_prepare`.

Has :class:`bool` check implemented, e.g.::

if not await ws.can_prepare(...):
cannot_start_websocket()

.. attribute:: ok

``True`` if websocket connection can be established, ``False``
otherwise.


.. attribute:: protocol

:class:`str` represented selected websocket sub-protocol.

.. seealso:: :meth:`WebSocketResponse.can_prepare`


json_response
-------------

Expand Down

0 comments on commit 81fbd19

Please sign in to comment.