A channel == a process

It’s at: Phoenix.Endpoint — Phoenix v1.8.8

To join you’d actually do:

def join("users", %{"id" => id}, socket) do
  MyEndpoint.subscribe("users:" <> id)
end

At which point this same "users" process will get messages for "users:"<>id, but it will not automatically forward them to the client, to do that you just listen for them (just like any other PubSub message, Phoenix Channels are just Phoenix.PubSub underneath) and then push them to the client however you want. :slight_smile:

3 Likes