Skip to content

Commit

Permalink
Rename argument to
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Dec 12, 2020
1 parent 62717a8 commit 4c69c9a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
8 changes: 4 additions & 4 deletions example/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ def leave(message):
'count': session['receive_count']})


@socketio.event
def close_room(message):
@socketio.on('close_room')
def on_close_room(message):
session['receive_count'] = session.get('receive_count', 0) + 1
emit('my_response', {'data': 'Room ' + message['room'] + ' is closing.',
'count': session['receive_count']},
room=message['room'])
to=message['room'])
close_room(message['room'])


Expand All @@ -79,7 +79,7 @@ def my_room_event(message):
session['receive_count'] = session.get('receive_count', 0) + 1
emit('my_response',
{'data': message['data'], 'count': session['receive_count']},
room=message['room'])
to=message['room'])


@socketio.event
Expand Down
22 changes: 12 additions & 10 deletions flask_socketio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,9 @@ def ping():
:param args: A dictionary with the JSON data to send as payload.
:param namespace: The namespace under which the message is to be sent.
Defaults to the global namespace.
:param room: Send the message to all the users in the given room. If
this parameter is not included, the event is sent to
all connected users.
:param to: Send the message to all the users in the given room. If
this parameter is not included, the event is sent to all
connected users.
:param include_self: ``True`` to include the sender when broadcasting
or addressing a room, or ``False`` to send to
everyone but the sender.
Expand Down Expand Up @@ -476,9 +476,9 @@ def send(self, data, json=False, namespace=None, room=None,
otherwise.
:param namespace: The namespace under which the message is to be sent.
Defaults to the global namespace.
:param room: Send the message only to the users in the given room. If
this parameter is not included, the message is sent to
all connected users.
:param to: Send the message only to the users in the given room. If
this parameter is not included, the message is sent to all
connected users.
:param include_self: ``True`` to include the sender when broadcasting
or addressing a room, or ``False`` to send to
everyone but the sender.
Expand Down Expand Up @@ -721,7 +721,6 @@ def test_client(self, app, namespace=None, query_string=None,
flask_test_client=flask_test_client)

def _handle_event(self, handler, message, namespace, sid, *args):
eio_sid = self.server.manager.eio_sid_from_sid(sid, namespace)
environ = self.server.get_environ(sid, namespace=namespace)
if not environ:
# we don't have record of this client, ignore this event
Expand Down Expand Up @@ -788,8 +787,9 @@ def handle_my_custom_event(json):
acknowledgement.
:param broadcast: ``True`` to send the message to all clients, or ``False``
to only reply to the sender of the originating event.
:param room: Send the message to all the users in the given room. If this
argument is set, then broadcast is implied to be ``True``.
:param to: Send the message to all the users in the given room. If this
argument is not set and ``broadcast`` is ``False``, then the
message is sent only to the originating user.
:param include_self: ``True`` to include the sender when broadcasting or
addressing a room, or ``False`` to send to everyone
but the sender.
Expand Down Expand Up @@ -844,7 +844,9 @@ def send(message, **kwargs):
:param broadcast: ``True`` to send the message to all connected clients, or
``False`` to only reply to the sender of the originating
event.
:param room: Send the message to all the users in the given room.
:param to: Send the message to all the users in the given room. If this
argument is not set and ``broadcast`` is ``False``, then the
message is sent only to the originating user.
:param include_self: ``True`` to include the sender when broadcasting or
addressing a room, or ``False`` to send to everyone
but the sender.
Expand Down

0 comments on commit 4c69c9a

Please sign in to comment.