We've found ourselves in need of some extra functionality in Phoenix.Socket, namely:
- Logging disconnect events with the `reason` atom coming from Cowboy
- Monitoring open sockets so that we can drain sockets in coordination with our load balancer
Neither of these appear to be possible based on the currently existing Phoenix.Socket callbacks or telemetry events.
As a workaround, we've created our own Socket module to allow us to override the built-in callbacks:
Obviously not a great solution as it's relying on non-public interfaces.
1) Are there a better solutions for the issues we've run in to that we may have missed?
2) Would the team be open to PRs extending Phoenix.Socket by either adding new callbacks or new telemetry events which would provide official avenues for solving our issues?
Cheers!