Skip to content

Commit 8c2a6ac

Browse files
Improved documentation of call() method (Fixes #813)
1 parent ea84b9b commit 8c2a6ac

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

src/socketio/asyncio_client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,12 @@ async def send(self, data, namespace=None, callback=None):
254254
async def call(self, event, data=None, namespace=None, timeout=60):
255255
"""Emit a custom event to a client and wait for the response.
256256
257+
This method issues an emit with a callback and waits for the callback
258+
to be invoked before returning. If the callback isn't invoked before
259+
the timeout, then a ``TimeoutError`` exception is raised. If the
260+
Socket.IO connection drops during the wait, this method still waits
261+
until the specified timeout.
262+
257263
:param event: The event name. It can be any string. The event names
258264
``'connect'``, ``'message'`` and ``'disconnect'`` are
259265
reserved and should not be used.

src/socketio/asyncio_server.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,12 @@ async def call(self, event, data=None, to=None, sid=None, namespace=None,
210210
timeout=60, **kwargs):
211211
"""Emit a custom event to a client and wait for the response.
212212
213+
This method issues an emit with a callback and waits for the callback
214+
to be invoked before returning. If the callback isn't invoked before
215+
the timeout, then a ``TimeoutError`` exception is raised. If the
216+
Socket.IO connection drops during the wait, this method still waits
217+
until the specified timeout.
218+
213219
:param event: The event name. It can be any string. The event names
214220
``'connect'``, ``'message'`` and ``'disconnect'`` are
215221
reserved and should not be used.

src/socketio/client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,12 @@ def send(self, data, namespace=None, callback=None):
430430
def call(self, event, data=None, namespace=None, timeout=60):
431431
"""Emit a custom event to a client and wait for the response.
432432
433+
This method issues an emit with a callback and waits for the callback
434+
to be invoked before returning. If the callback isn't invoked before
435+
the timeout, then a ``TimeoutError`` exception is raised. If the
436+
Socket.IO connection drops during the wait, this method still waits
437+
until the specified timeout.
438+
433439
:param event: The event name. It can be any string. The event names
434440
``'connect'``, ``'message'`` and ``'disconnect'`` are
435441
reserved and should not be used.

src/socketio/server.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,12 @@ def call(self, event, data=None, to=None, sid=None, namespace=None,
355355
timeout=60, **kwargs):
356356
"""Emit a custom event to a client and wait for the response.
357357
358+
This method issues an emit with a callback and waits for the callback
359+
to be invoked before returning. If the callback isn't invoked before
360+
the timeout, then a ``TimeoutError`` exception is raised. If the
361+
Socket.IO connection drops during the wait, this method still waits
362+
until the specified timeout.
363+
358364
:param event: The event name. It can be any string. The event names
359365
``'connect'``, ``'message'`` and ``'disconnect'`` are
360366
reserved and should not be used.

0 commit comments

Comments
 (0)