Send a message to one or more connected clients. 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``, ``li
(self, data, to=None, room=None, skip_sid=None, namespace=None,
callback=None, ignore_queue=False)
| 169 | ignore_queue=ignore_queue) |
| 170 | |
| 171 | def send(self, data, to=None, room=None, skip_sid=None, namespace=None, |
| 172 | callback=None, ignore_queue=False): |
| 173 | """Send a message to one or more connected clients. |
| 174 | |
| 175 | This function emits an event with the name ``'message'``. Use |
| 176 | :func:`emit` to issue custom event names. |
| 177 | |
| 178 | :param data: The data to send to the client or clients. Data can be of |
| 179 | type ``str``, ``bytes``, ``list`` or ``dict``. To send |
| 180 | multiple arguments, use a tuple where each element is of |
| 181 | one of the types indicated above. |
| 182 | :param to: The recipient of the message. This can be set to the |
| 183 | session ID of a client to address only that client, to any |
| 184 | any custom room created by the application to address all |
| 185 | the clients in that room, or to a list of custom room |
| 186 | names. If this argument is omitted the event is broadcasted |
| 187 | to all connected clients. |
| 188 | :param room: Alias for the ``to`` parameter. |
| 189 | :param skip_sid: The session ID of a client to skip when broadcasting |
| 190 | to a room or to all clients. This can be used to |
| 191 | prevent a message from being sent to the sender. To |
| 192 | skip multiple sids, pass a list. |
| 193 | :param namespace: The Socket.IO namespace for the event. If this |
| 194 | argument is omitted the event is emitted to the |
| 195 | default namespace. |
| 196 | :param callback: If given, this function will be called to acknowledge |
| 197 | the client has received the message. The arguments |
| 198 | that will be passed to the function are those provided |
| 199 | by the client. Callback functions can only be used |
| 200 | when addressing an individual client. |
| 201 | :param ignore_queue: Only used when a message queue is configured. If |
| 202 | set to ``True``, the event is emitted to the |
| 203 | clients directly, without going through the queue. |
| 204 | This is more efficient, but only works when a |
| 205 | single server process is used. It is recommended |
| 206 | to always leave this parameter with its default |
| 207 | value of ``False``. |
| 208 | """ |
| 209 | self.emit('message', data=data, to=to, room=room, skip_sid=skip_sid, |
| 210 | namespace=namespace, callback=callback, |
| 211 | ignore_queue=ignore_queue) |
| 212 | |
| 213 | def call(self, event, data=None, to=None, sid=None, namespace=None, |
| 214 | timeout=60, ignore_queue=False): |