Server side connect to another channel

Hello,
in my “unauth” channel I wait until the client sends me the auth token a then I want to connect him to another channel using that token.
I am able to do so from client side BUT, Is there any way how to do it server-side from handle_in in first “unauth” channel?

MyApp.Endpoint.broadcast_from!(self(), "authChannel", "phx_join", %{action: %{type: "yolo"}, ref: "123"})

I tried this but it is not working for me :((

Thnx, gus

Not possible. The client must join

1 Like

Thnx for fast reply, and is it the same case with “leaving” channel? Do I have to make it client side ? Thnx

The channel can gracefully terminate from the server by returning {:stop, :normal, socket}

In which case, the client receives the event and fire myChannel.onClose callbacks

1 Like

Thank you very much Chris!