Perspective session connection closed unexpectedly

I have some clean-up that needs to occur when a session ends. If the user logs out this is a simple task. On tablets, sometimes the user just kills the application rather than logging out. Is there a way to trigger a Gateway script or session script to run when this occurs? When the operator does this, it generates a log in the event log, but I don't know how to run a script off of an specific error in the log.

There is a session event for this, but note that it runs after a timeout, since browsers generally do not affirmatively close sessions.

Yes, there are Session Events, including the Shutdown Event. Note that a user logging out does not shut down the session, so be wary of logic dependent on a user logging out.

Thanks that worked!

A Shutdown Session event occurs for one of 6 reasons listed in the description of the event. Is there a way to determine which one of the six reasons are the source of the event?

Also, is there documentation anywhere for what is inside the session parameter? I suspect, if it's possible, the event reason inside that, but I'm not sure how to search/extract that information.

This is a breakdown of everything the session object believes it has access to. It's a full-blown session object.
Screenshot 2024-03-27 at 11.51.26 AM

Thanks cmallonee - I did see that, but wasn't able to find what I'm looking for. Are those items listed somewhere in detail online?

My main question is still, can I tell what/why the event was triggered?

No, the Event does not provide any context as to why the session was shutdown, nor does the session itself have any idea why it is going through the shutdown process.

Roger that. Thank you