Skip to content

Commit

Permalink
Merge branch 'master' of github.com:KeepSafe/aiohttp
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 committed Jan 4, 2015
2 parents 991214a + 18ffb6b commit 27fcbde
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions docs/web.rst
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,47 @@ Response
*Content-Length* HTTP header.
WebSocketResponse
^^^^^^^^^^^^^^^^^
.. class:: WebSocketResponse(*, protocols=())
Class for handling server-side websockets.
After starting (by :meth:`start` call) the response you
cannot use :meth:`~StreamResponse.write` method but should to
communicate with websocket client by :meth:`send_str`,
:meth:`receive` and others.
.. method:: start(request)
Starts websocket. After the call you can use websocket methods.
:param aiohttp.web.Request request: HTTP request object, that the
response answers.
:raises HTTPException: if websocket handshake has failed.
.. method:: can_start(request)
Performs checks for *request* data to figure out if websocket
can be started on the request.
If :meth:`can_start` call is success then :meth:`start` will success too.
:param aiohttp.web.Request request: HTTP request object, that the
response answers.
:return: ``(ok, protocol)`` pair, *ok* is ``True`` on success,
*protocol* is websocket subprotocol which is passed by
client and accepted by server (one of *protocols*
sequence from :class:`WebSocketResponse` ctor). *protocol* may be
``None``.
.. note:: The method newer raises exception.
.. _aiohttp-web-app-and-router:
Application and Router
Expand Down

0 comments on commit 27fcbde

Please sign in to comment.