In Elixir and Phoenix, I can get session in Controller by
Plug.Conn.get_session(conn, :id)
So how to get session in other module as a module use Phoenix.Channel
?
Plug.Conn
is not available in Phoenix.Channel
. Channels rely on Phoenix.Socket
instead and you can use Phoenix.Token
for authentication.
Here's a tutorial on how to authenticate channels in Phoenix.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With