MCPcopy Create free account
hub / github.com/miguelgrinberg/python-socketio / send

Method send

src/socketio/client.py:241–260  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

239 data=[event] + data, id=id))
240
241 def send(self, data, namespace=None, callback=None):
242 """Send a message to the server.
243
244 This function emits an event with the name ``'message'``. Use
245 :func:`emit` to issue custom event names.
246
247 :param data: The data to send to the server. Data can be of
248 type ``str``, ``bytes``, ``list`` or ``dict``. To send
249 multiple arguments, use a tuple where each element is of
250 one of the types indicated above.
251 :param namespace: The Socket.IO namespace for the event. If this
252 argument is omitted the event is emitted to the
253 default namespace.
254 :param callback: If given, this function will be called to acknowledge
255 the server has received the message. The arguments
256 that will be passed to the function are those provided
257 by the server.
258 """
259 self.emit('message', data=data, namespace=namespace,
260 callback=callback)
261
262 def call(self, event, data=None, namespace=None, timeout=60):
263 """Emit a custom event to the server and wait for the response.

Callers 5

test_sendMethod · 0.95
_send_packetMethod · 0.45
_publishMethod · 0.45
_publishMethod · 0.45

Calls 1

emitMethod · 0.95

Tested by 2

test_sendMethod · 0.76