Nicholas Hubbard
Nicholas Hubbard

Reputation: 537

How can I run code upon session death with Yesod?

I would like to run code whenever a Yesod session dies. For example whenever a session dies I would like to print "hello" to the console.

I did not use the scaffolding for my application.

Upvotes: 1

Views: 50

Answers (1)

MaxGabriel
MaxGabriel

Reputation: 7705

Yesod's default sessions are done with clientsession. This works by storing encrypted data in the cookies from the browser—the server doesn't store any state. For this reason, I don't think there's a way to accomplish what you want.

You could switch to some sort of server-stored session, in which case you could kinda do this based off a session expiring, though you'd never be able to detect something like "the user cleared their cookies" which effectively kills a session.

Upvotes: 2

Related Questions