In Elixir, Phoenix, how to get a session in another module as a module, use Phoenix.Channel?

In Elixir and Phoenix, I can get a session in the controller

Plug.Conn.get_session(conn, :id)

So how to get a session in another module as a module, use Phoenix.Channel?

+4
source share
1 answer

Plug.Connunavailable at Phoenix.Channel. Channels rely on Phoenix.Socket, and you can use Phoenix.Tokenfor authentication.

Here's a tutorial on how to authenticate channels in Phoenix.

+8
source

Source: https://habr.com/ru/post/1621562/


All Articles