I see there is a question about this topic, but the specific code is not outlined. Say I want to emit only to the first client.
For example (in events.py):
clients = []
@socketio.on('joined', namespace='/chat')
def joined(message):
"""Sent by clients when they enter a room.
A status message is broadcast to all people in the room."""
#Add client to client list
clients.append([session.get('name'), request.namespace])
room = session.get('room')
join_room(room)
emit('status', {'msg': session.get('name') + ' has entered the room.'}, room=room)
#I want to do something like this, emit message to the first client
clients[0].emit('status', {'msg': session.get('name') + ' has entered the room.'}, room=room)
How is this done properly?
Thanks