Skip to content

Commit

Permalink
add optional sid argument to disconnect function
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Mar 9, 2018
1 parent 8d64c78 commit ff9f385
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions flask_socketio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ def rooms(sid=None, namespace=None):
return socketio.server.rooms(sid, namespace=namespace)


def disconnect(silent=False):
def disconnect(sid=None, silent=False):
"""Disconnect the client.
This function terminates the connection with the client. As a result of
Expand All @@ -845,8 +845,10 @@ def receive_message(msg):
disconnect()
# ...
:param sid: The session id of the client. If not provided, the client is
obtained from the request context.
:param silent: this option is deprecated.
"""
socketio = flask.current_app.extensions['socketio']
return socketio.server.disconnect(flask.request.sid,
return socketio.server.disconnect(sid or flask.request.sid,
namespace=flask.request.namespace)

0 comments on commit ff9f385

Please sign in to comment.