diff --git a/socketio/asyncio_client.py b/socketio/asyncio_client.py index b848ecd..38b9efe 100644 --- a/socketio/asyncio_client.py +++ b/socketio/asyncio_client.py @@ -139,17 +139,17 @@ class AsyncClient(client.Client): :param event: The event name. It can be any string. The event names ``'connect'``, ``'message'`` and ``'disconnect'`` are reserved and should not be used. - :param data: The data to send to the client or clients. Data can be of - type ``str``, ``bytes``, ``list`` or ``dict``. If a - ``list`` or ``dict``, the data will be serialized as JSON. + :param data: The data to send to the server. Data can be of + type ``str``, ``bytes``, ``list`` or ``dict``. To send + multiple arguments, use a tuple where each element is of + one of the types indicated above. :param namespace: The Socket.IO namespace for the event. If this argument is omitted the event is emitted to the default namespace. :param callback: If given, this function will be called to acknowledge - the the client has received the message. The arguments + the the server has received the message. The arguments that will be passed to the function are those provided - by the client. Callback functions can only be used - when addressing an individual client. + by the server. Note: this method is not designed to be used concurrently. If multiple tasks are emitting at the same time on the same client connection, then @@ -190,17 +190,17 @@ class AsyncClient(client.Client): This function emits an event with the name ``'message'``. Use :func:`emit` to issue custom event names. - :param data: The data to send to the client or clients. Data can be of - type ``str``, ``bytes``, ``list`` or ``dict``. If a - ``list`` or ``dict``, the data will be serialized as JSON. + :param data: The data to send to the server. Data can be of + type ``str``, ``bytes``, ``list`` or ``dict``. To send + multiple arguments, use a tuple where each element is of + one of the types indicated above. :param namespace: The Socket.IO namespace for the event. If this argument is omitted the event is emitted to the default namespace. :param callback: If given, this function will be called to acknowledge - the the client has received the message. The arguments + the the server has received the message. The arguments that will be passed to the function are those provided - by the client. Callback functions can only be used - when addressing an individual client. + by the server. Note: this method is a coroutine. """ @@ -213,9 +213,10 @@ class AsyncClient(client.Client): :param event: The event name. It can be any string. The event names ``'connect'``, ``'message'`` and ``'disconnect'`` are reserved and should not be used. - :param data: The data to send to the client or clients. Data can be of - type ``str``, ``bytes``, ``list`` or ``dict``. If a - ``list`` or ``dict``, the data will be serialized as JSON. + :param data: The data to send to the server. Data can be of + type ``str``, ``bytes``, ``list`` or ``dict``. To send + multiple arguments, use a tuple where each element is of + one of the types indicated above. :param namespace: The Socket.IO namespace for the event. If this argument is omitted the event is emitted to the default namespace. diff --git a/socketio/asyncio_server.py b/socketio/asyncio_server.py index 20da548..3c4003d 100644 --- a/socketio/asyncio_server.py +++ b/socketio/asyncio_server.py @@ -91,8 +91,9 @@ class AsyncServer(server.Server): ``'connect'``, ``'message'`` and ``'disconnect'`` are reserved and should not be used. :param data: The data to send to the client or clients. Data can be of - type ``str``, ``bytes``, ``list`` or ``dict``. If a - ``list`` or ``dict``, the data will be serialized as JSON. + type ``str``, ``bytes``, ``list`` or ``dict``. To send + multiple arguments, use a tuple where each element is of + one of the types indicated above. :param to: The recipient of the message. This can be set to the session ID of a client to address only that client, or to to any custom room created by the application to address all @@ -142,8 +143,9 @@ class AsyncServer(server.Server): :func:`emit` to issue custom event names. :param data: The data to send to the client or clients. Data can be of - type ``str``, ``bytes``, ``list`` or ``dict``. If a - ``list`` or ``dict``, the data will be serialized as JSON. + type ``str``, ``bytes``, ``list`` or ``dict``. To send + multiple arguments, use a tuple where each element is of + one of the types indicated above. :param to: The recipient of the message. This can be set to the session ID of a client to address only that client, or to to any custom room created by the application to address all @@ -183,8 +185,9 @@ class AsyncServer(server.Server): ``'connect'``, ``'message'`` and ``'disconnect'`` are reserved and should not be used. :param data: The data to send to the client or clients. Data can be of - type ``str``, ``bytes``, ``list`` or ``dict``. If a - ``list`` or ``dict``, the data will be serialized as JSON. + type ``str``, ``bytes``, ``list`` or ``dict``. To send + multiple arguments, use a tuple where each element is of + one of the types indicated above. :param to: The session ID of the recipient client. :param sid: Alias for the ``to`` parameter. :param namespace: The Socket.IO namespace for the event. If this diff --git a/socketio/client.py b/socketio/client.py index e0d441d..34e2964 100644 --- a/socketio/client.py +++ b/socketio/client.py @@ -307,17 +307,17 @@ class Client(object): :param event: The event name. It can be any string. The event names ``'connect'``, ``'message'`` and ``'disconnect'`` are reserved and should not be used. - :param data: The data to send to the client or clients. Data can be of - type ``str``, ``bytes``, ``list`` or ``dict``. If a - ``list`` or ``dict``, the data will be serialized as JSON. + :param data: The data to send to the server. Data can be of + type ``str``, ``bytes``, ``list`` or ``dict``. To send + multiple arguments, use a tuple where each element is of + one of the types indicated above. :param namespace: The Socket.IO namespace for the event. If this argument is omitted the event is emitted to the default namespace. :param callback: If given, this function will be called to acknowledge - the the client has received the message. The arguments + the the server has received the message. The arguments that will be passed to the function are those provided - by the client. Callback functions can only be used - when addressing an individual client. + by the server. Note: this method is not thread safe. If multiple threads are emitting at the same time on the same client connection, messages composed of @@ -356,17 +356,17 @@ class Client(object): This function emits an event with the name ``'message'``. Use :func:`emit` to issue custom event names. - :param data: The data to send to the client or clients. Data can be of - type ``str``, ``bytes``, ``list`` or ``dict``. If a - ``list`` or ``dict``, the data will be serialized as JSON. + :param data: The data to send to the server. Data can be of + type ``str``, ``bytes``, ``list`` or ``dict``. To send + multiple arguments, use a tuple where each element is of + one of the types indicated above. :param namespace: The Socket.IO namespace for the event. If this argument is omitted the event is emitted to the default namespace. :param callback: If given, this function will be called to acknowledge - the the client has received the message. The arguments + the the server has received the message. The arguments that will be passed to the function are those provided - by the client. Callback functions can only be used - when addressing an individual client. + by the server. """ self.emit('message', data=data, namespace=namespace, callback=callback) @@ -377,9 +377,10 @@ class Client(object): :param event: The event name. It can be any string. The event names ``'connect'``, ``'message'`` and ``'disconnect'`` are reserved and should not be used. - :param data: The data to send to the client or clients. Data can be of - type ``str``, ``bytes``, ``list`` or ``dict``. If a - ``list`` or ``dict``, the data will be serialized as JSON. + :param data: The data to send to the server. Data can be of + type ``str``, ``bytes``, ``list`` or ``dict``. To send + multiple arguments, use a tuple where each element is of + one of the types indicated above. :param namespace: The Socket.IO namespace for the event. If this argument is omitted the event is emitted to the default namespace. diff --git a/socketio/server.py b/socketio/server.py index 01dcf94..680dbae 100644 --- a/socketio/server.py +++ b/socketio/server.py @@ -253,8 +253,9 @@ class Server(object): ``'connect'``, ``'message'`` and ``'disconnect'`` are reserved and should not be used. :param data: The data to send to the client or clients. Data can be of - type ``str``, ``bytes``, ``list`` or ``dict``. If a - ``list`` or ``dict``, the data will be serialized as JSON. + type ``str``, ``bytes``, ``list`` or ``dict``. To send + multiple arguments, use a tuple where each element is of + one of the types indicated above. :param to: The recipient of the message. This can be set to the session ID of a client to address only that client, or to to any custom room created by the application to address all @@ -302,8 +303,9 @@ class Server(object): :func:`emit` to issue custom event names. :param data: The data to send to the client or clients. Data can be of - type ``str``, ``bytes``, ``list`` or ``dict``. If a - ``list`` or ``dict``, the data will be serialized as JSON. + type ``str``, ``bytes``, ``list`` or ``dict``. To send + multiple arguments, use a tuple where each element is of + one of the types indicated above. :param to: The recipient of the message. This can be set to the session ID of a client to address only that client, or to to any custom room created by the application to address all @@ -341,8 +343,9 @@ class Server(object): ``'connect'``, ``'message'`` and ``'disconnect'`` are reserved and should not be used. :param data: The data to send to the client or clients. Data can be of - type ``str``, ``bytes``, ``list`` or ``dict``. If a - ``list`` or ``dict``, the data will be serialized as JSON. + type ``str``, ``bytes``, ``list`` or ``dict``. To send + multiple arguments, use a tuple where each element is of + one of the types indicated above. :param to: The session ID of the recipient client. :param sid: Alias for the ``to`` parameter. :param namespace: The Socket.IO namespace for the event. If this