I am trying to implement a socket app using flask-socketio that can send private messages, and one thing that I need to do is store the request.sid for each user so that I can send messages directly to that user. Although, every time the user sends a request, their request.sid changes. This is some sample code that I am using to check the users sid:
@socket_.on('check_requestid', namespace='/check')
def check():
print(request.sid)
This is my socket init code:
app = Flask(__name__)
app.secret_key = "Secret_Key"
#SocketIO
socket_ = SocketIO(app)
I am not sure what is happening and why my socket connection keeps changing its sid.