Reputation: 1181
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
?
Upvotes: 4
Views: 2839
Reputation: 7779
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.
Upvotes: 7