Is there a relatively simple, documented way in a Phoenix application to read how many active sockets and channels are currently open at any given time? And more specifically, is it possible to filter this data by topic and other channel connection metadata?
My use case is for analytics on active connections to my backend.
Thanks for any suggestions!
You are looking for
Phoenix.Presence
. From the documentation:Basically, you are supposed to implement
Phoenix.Presence
behaviour (the almost ready-to-go example is there in docs,) andPhoenix.Tracker
according to your needs.