Listening to Heartbeat & Disconnections without Channels & Presence

Hi!

I am trying to see if I can listen to heartbeat & disconnect events without having to use user channels & presence

  1. I am seeing if I can avoid creating user channels if the socket is given the proper user-id.

  2. Phoenix presence is not real-time it has a slight delay. So if I could use heart-beat & listen to disconnect/terminate events, that would be great.

I understand that it is possible to listen to telemetry events within application.ex but the documentation around this looks non-existent.

I want to understand the complete socket lifecycle implementation of Phoenix & how can we listen into various. If we have any resource which explains this in detail, that would be great.

Thanks!