Reputation: 23
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.
Upvotes: 0
Views: 144
Reputation: 67479
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
Upvotes: 1