Removing Flask Session
In my app after logging in, I set: session['venue_id'] = True In my javascript I then connect to my websocket: var socket = io.connect('http://my.ip.address.' + ':' + '80' + names
Solution 1:
You need to send a (non-websocket) response to alter the session. Just popping the value does nothing, as the browser doesn't update it's side and just sends the data again next request. Right now, the application:
- Logs in, sets value, returns response
- Sends request (for websocket), sends value
- Whatever response socket sends occurs before
test_connect
event handler, so doesn't pop value - Event handler runs, no way to tell browswer that session has changed
- Whatever response socket sends occurs before
- Browser sends request for other page, sends value
Probably the simplest solution is to store the session server side, where you can alter it even without sending a response.
Post a Comment for "Removing Flask Session"