Disconnect/quit handler in LiveView process

I am looking for an equivalent to mount in a LiveView module that is called when the client disconnects whether by losing internet connection or leaving the page. In response to this event I want to execute server-side code. From a lot of googling I could not find this functionality.

This is probably a bad comparison but where I have used equivalent functionality before is Vue where you have mounted and unmounted: Lifecycle Hooks | Vue.js.

Cheers, Kim

It’s all about knowing the right keywords in google! There’s a discussion about this in the following GitHub issue:

In short, you use another process to monitor the LiveView process and it receives events when the LiveView process terminates.