Why does Phoenix channel not expose all callbacks of GenServer?

I’m confused as to why Phoenix.Channel — Phoenix v1.7.12 does not expose all callbacks of GenServer — Elixir v1.16.2, for example handle_continue. I’ll only talk about handle_continue in this post, but it’s not the only one.

Functions like handle_info explicitly state that they work like their corresponding gen_server versions Phoenix.Channel — Phoenix v1.7.12, and the code clearly shows that a channel is a gen_server with more stuff on top: phoenix/lib/phoenix/channel.ex at v1.7.12 · phoenixframework/phoenix · GitHub

      def start_link(triplet) do
        GenServer.start_link(Phoenix.Channel.Server, triplet,
          hibernate_after: @phoenix_hibernate_after

I’m assuming there’s a good reason, so why aren’t all gen_server callback functions exposed from phoenix channel?

Is there some invariant in phoenix channels or so that makes it so that handle_continue doesn’t make sense for channels?

If not, is it simply the case that not enough people have asked for it before, and it would make sense to add them? I’d be happy to submit a PR.

1 Like