Browse Source

Update server.rst

Mentioned that rooms are created in the global default namespace and take an optional argument "namespace" to define the namespace the room is created in.
pull/497/head
Stephen Brown 5 years ago
committed by GitHub
parent
commit
bec7d07916
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      docs/server.rst

5
docs/server.rst

@ -350,12 +350,17 @@ to the connection. The application is then free to create additional rooms and
manage which clients are in them using the :func:`socketio.Server.enter_room` manage which clients are in them using the :func:`socketio.Server.enter_room`
and :func:`socketio.Server.leave_room` methods. Clients can be in as many and :func:`socketio.Server.leave_room` methods. Clients can be in as many
rooms as needed and can be moved between rooms as often as necessary. rooms as needed and can be moved between rooms as often as necessary.
Rooms are created in the default global namespace, but can be directed to a custom namespace with the optional argument :func:`namespace`.
:: ::
@sio.event @sio.event
def begin_chat(sid): def begin_chat(sid):
sio.enter_room(sid, 'chat_users') sio.enter_room(sid, 'chat_users')
@sio.event
def begin_chat(sid):
sio.enter_room(sid, 'chat_users', namespace='/chat')
@sio.event @sio.event
def exit_chat(sid): def exit_chat(sid):

Loading…
Cancel
Save