Ну вот Крис сам такое советовал:
It’s not entirely clear what your use case is, but you have a couple options:
1 On join, have another process monitor you, then when you disconnect, they will receive {:DOWN, ...} and you can handle whatever you need to do. This only works assuming you need to react to clients leaving the same way, regardless of how many are connected. For example, if I open 5 tabs, this setup will fire the callbacks as I close each one, rather than when my “last” tab is closed. This may or may not be what you’re wanting.
2 You can have another process call MyApp.Endpoint.subscribe("some:topic") where the topic is the channel topic(s) you’re wanting to watch over. This process will then receive presence_diff events and you can react accordingly. This setup let’s you know more, like how many tabs/devices are connected for the same user, and whether the “last” one has left, but then you also need to manage when to subscribe to new topics, and unsubscribe from ones that are no longer being tracked by active channels on the local node.
Вот нашёл, почему я отказался — мне нужно именно трекать, когда последний так закрыли