@socketio.on("init")
def init(user_data: dict) -> None:
sid = request.sid
user_agent = request.headers.get("User-Agent")
clients.update({
sid: {
"client": Client(sid, user_agent=user_agent),
"data": user_data
}
})
socketio.start_background_task(target=clients[sid]["client"].run)