flask-socketio for competing with multiple users

15 Views Asked by At

I want to create an exam web app where there are three pages... First page where the logged in user invites all the friends they want to compete in the exam with. After sending invite from the button, the user is redirected to the second page where he waits for his friends who have accepted the invitation to come to that page. After waiting for a while he starts the exam with a button and all the users must be redirected to the questions page where they will give there answers accordingly. And at last score of all the users must be shown.

users = {}

@socketio.on('connect')
def handle_connect():
    users[session['username']] = request.sid
    print("user added")


@socketio.on('disconnect')
def handle_disconnect():
    del session['username']
    print("user removed")

This is all I know that we can save the sid of a page, but the problem is that whenever the page refreshes or changes, sid changes as well. I know how to maintain this in a single page, but I want it to be on 3 pages. Please help.

Any help is appreciated.

0

There are 0 best solutions below