Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Allow a "cleanup" callback that is executed when a session ends #2346

Open
xhluca opened this issue Dec 1, 2022 · 0 comments

Comments

@xhluca
Copy link

xhluca commented Dec 1, 2022

It would be nice to have something like this, sort of the opposite of a serve_layout() function that gets executed with app.layout for every new session. This would allow, for example, server-side storing (e.g. using Redis) that would delete session data when the user disconnects.

def serve_layout():
  user_id = uuid4()
  redis_db[user_id] = <some data here>
  ...
  return layout

app.layout = serve_layout

@dash.on_end_session
def cleanup_layout():
  del redis_db[user_id]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant