0

Is there a way to limit the use of certain events to room members only? I don't need to limit to a specific room, but need to make sure the client has joined a room before the event is available for their use.

1 Answers1

1

No, this isn't available, but you can easily get the list of rooms your client is in with the rooms() function. So you can do something like this:

@socketio.on('foo')
def my_foo_event(data):
    if 'required_room' not in rooms():
        return  # or return an error event, etc.
    # handle the event here
Miguel Grinberg
  • 65,299
  • 14
  • 133
  • 152