简体   繁体   中英

Flask-Session session not saving inside a Flask-SocketIO websocket request

I am using Flask-Session with Flask-SocketIO, but when I try to save my session from inside a websocket, it does not store, even though I am using server side session storage. I am redirecting the user directly after the session is stored.

session['li'] = True
session['id'] = account['id']
session.modified = True

Flask 2.2.2
Flask-Session 0.4.0
Flask-SocketIO 5.3.0

Well, I found a solution by adding a random key-value pair to the session when the login page was opened.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM