Skip to content

Commit d530850

Browse files
Document the use of arguments in the connect_error handler (Fixes miguelgrinberg#554)
1 parent 7d2e7f7 commit d530850

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

docs/client.rst

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,24 @@ server::
7474
print("I'm connected!")
7575

7676
@sio.event
77-
def connect_error():
77+
def connect_error(data):
7878
print("The connection failed!")
7979

8080
@sio.event
8181
def disconnect():
8282
print("I'm disconnected!")
8383

84-
Note that the ``disconnect`` handler is invoked for application initiated
85-
disconnects, server initiated disconnects, or accidental disconnects, for
86-
example due to networking failures. In the case of an accidental
87-
disconnection, the client is going to attempt to reconnect immediately after
88-
invoking the disconnect handler. As soon as the connection is re-established
89-
the connect handler will be invoked once again.
84+
The ``connect_error`` handler is invoked when a connection attempt fails. If
85+
the server provides arguments, these are passed on to the handler. The server
86+
can use an argument to provide information to the client regarding the
87+
connection failure.
88+
89+
The ``disconnect`` handler is invoked for application initiated disconnects,
90+
server initiated disconnects, or accidental disconnects, for example due to
91+
networking failures. In the case of an accidental disconnection, the client is
92+
going to attempt to reconnect immediately after invoking the disconnect
93+
handler. As soon as the connection is re-established the connect handler will
94+
be invoked once again.
9095

9196
If the server includes arguments with an event, those are passed to the
9297
handler function as arguments.

0 commit comments

Comments
 (0)