Extending Phoenix.Socket

93 views
Skip to first unread message

Ryan Johnson

unread,
Mar 29, 2022, 1:13:29 PM3/29/22
to phoenix-core
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!

José Valim

unread,
Mar 29, 2022, 2:01:40 PM3/29/22
to phoeni...@googlegroups.com
A terminate callback would be a welcome addition imo. Need to consider what happens in regards to long polling though. :)

--
You received this message because you are subscribed to the Google Groups "phoenix-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phoenix-core...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/phoenix-core/5c1cc2b1-961e-471d-9dd9-b225cf207cc1n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages