def on_leave(data): username = data['username'] room = data['room'] Room.find(room).leave(username) leave_room(room) socketio.send(username + ' has left the room.', room=room) print('[noti] ' + username + ' has left the ' + room)
def on_join(data): # If the user first connects, it is the same as the room name username = data['username'] room = data['room'] if not Room.IsExists(room): Room(username) else: Room.find(room).join(username) join_room(room) socketio.emit('in', {'data': username + ' entered the ' + room}, room=room) print('[noti] ' + username + ' entered the ' + room)