Browse Source

Document the use of arguments in the connect_error handler (Fixes #554)

pull/683/head
Miguel Grinberg 4 years ago
parent
commit
d5308504d3
No known key found for this signature in database GPG Key ID: 36848B262DF5F06C
  1. 19
      docs/client.rst

19
docs/client.rst

@ -74,19 +74,24 @@ server::
print("I'm connected!")
@sio.event
def connect_error():
def connect_error(data):
print("The connection failed!")
@sio.event
def disconnect():
print("I'm disconnected!")
Note that the ``disconnect`` handler is invoked for application initiated
disconnects, server initiated disconnects, or accidental disconnects, for
example due to networking failures. In the case of an accidental
disconnection, the client is going to attempt to reconnect immediately after
invoking the disconnect handler. As soon as the connection is re-established
the connect handler will be invoked once again.
The ``connect_error`` handler is invoked when a connection attempt fails. If
the server provides arguments, these are passed on to the handler. The server
can use an argument to provide information to the client regarding the
connection failure.
The ``disconnect`` handler is invoked for application initiated disconnects,
server initiated disconnects, or accidental disconnects, for example due to
networking failures. In the case of an accidental disconnection, the client is
going to attempt to reconnect immediately after invoking the disconnect
handler. As soon as the connection is re-established the connect handler will
be invoked once again.
If the server includes arguments with an event, those are passed to the
handler function as arguments.

Loading…
Cancel
Save