Skip to content Skip to sidebar Skip to footer

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:

  1. Logs in, sets value, returns response
  2. Sends request (for websocket), sends value
    1. Whatever response socket sends occurs before test_connect event handler, so doesn't pop value
    2. Event handler runs, no way to tell browswer that session has changed
  3. 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"