Send a message to the server. 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 server. Data can be of type ``str``, ``bytes``, ``list`` or ``dict``. To send
(self, data, namespace=None, callback=None)
| 249 | packet.EVENT, namespace=namespace, data=[event] + data, id=id)) |
| 250 | |
| 251 | async def send(self, data, namespace=None, callback=None): |
| 252 | """Send a message to the server. |
| 253 | |
| 254 | This function emits an event with the name ``'message'``. Use |
| 255 | :func:`emit` to issue custom event names. |
| 256 | |
| 257 | :param data: The data to send to the server. Data can be of |
| 258 | type ``str``, ``bytes``, ``list`` or ``dict``. To send |
| 259 | multiple arguments, use a tuple where each element is of |
| 260 | one of the types indicated above. |
| 261 | :param namespace: The Socket.IO namespace for the event. If this |
| 262 | argument is omitted the event is emitted to the |
| 263 | default namespace. |
| 264 | :param callback: If given, this function will be called to acknowledge |
| 265 | the server has received the message. The arguments |
| 266 | that will be passed to the function are those provided |
| 267 | by the server. |
| 268 | |
| 269 | Note: this method is a coroutine. |
| 270 | """ |
| 271 | await self.emit('message', data=data, namespace=namespace, |
| 272 | callback=callback) |
| 273 | |
| 274 | async def call(self, event, data=None, namespace=None, timeout=60): |
| 275 | """Emit a custom event to the server and wait for the response. |