i know that i can set the session to expire when user close the browser, and this is good. now i need a next step. The problem is this: The can start an action by clicking the button "start". This creates a tuple which is sotred in the database. This has a field called "status" that is set to IN PROGRESS. When the user push the button "end" i change the value of the status to FINISHED
Now, if between the "start" and "end" the user close the browser the session expires. What i want to do is to being able to intercept that the session is expired and remove the tuple from the database.
Basically what i want to do is run a function when session expires.