Skip to content

Commit

Permalink
Improved documentation of call() method (Fixes #813)
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Oct 26, 2021
1 parent ea84b9b commit 8c2a6ac
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/socketio/asyncio_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,12 @@ async def send(self, data, namespace=None, callback=None):
async def call(self, event, data=None, namespace=None, timeout=60):
"""Emit a custom event to a client and wait for the response.
This method issues an emit with a callback and waits for the callback
to be invoked before returning. If the callback isn't invoked before
the timeout, then a ``TimeoutError`` exception is raised. If the
Socket.IO connection drops during the wait, this method still waits
until the specified timeout.
:param event: The event name. It can be any string. The event names
``'connect'``, ``'message'`` and ``'disconnect'`` are
reserved and should not be used.
Expand Down
6 changes: 6 additions & 0 deletions src/socketio/asyncio_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,12 @@ async def call(self, event, data=None, to=None, sid=None, namespace=None,
timeout=60, **kwargs):
"""Emit a custom event to a client and wait for the response.
This method issues an emit with a callback and waits for the callback
to be invoked before returning. If the callback isn't invoked before
the timeout, then a ``TimeoutError`` exception is raised. If the
Socket.IO connection drops during the wait, this method still waits
until the specified timeout.
:param event: The event name. It can be any string. The event names
``'connect'``, ``'message'`` and ``'disconnect'`` are
reserved and should not be used.
Expand Down
6 changes: 6 additions & 0 deletions src/socketio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,12 @@ def send(self, data, namespace=None, callback=None):
def call(self, event, data=None, namespace=None, timeout=60):
"""Emit a custom event to a client and wait for the response.
This method issues an emit with a callback and waits for the callback
to be invoked before returning. If the callback isn't invoked before
the timeout, then a ``TimeoutError`` exception is raised. If the
Socket.IO connection drops during the wait, this method still waits
until the specified timeout.
:param event: The event name. It can be any string. The event names
``'connect'``, ``'message'`` and ``'disconnect'`` are
reserved and should not be used.
Expand Down
6 changes: 6 additions & 0 deletions src/socketio/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,12 @@ def call(self, event, data=None, to=None, sid=None, namespace=None,
timeout=60, **kwargs):
"""Emit a custom event to a client and wait for the response.
This method issues an emit with a callback and waits for the callback
to be invoked before returning. If the callback isn't invoked before
the timeout, then a ``TimeoutError`` exception is raised. If the
Socket.IO connection drops during the wait, this method still waits
until the specified timeout.
:param event: The event name. It can be any string. The event names
``'connect'``, ``'message'`` and ``'disconnect'`` are
reserved and should not be used.
Expand Down

0 comments on commit 8c2a6ac

Please sign in to comment.