
[英]How to get channel messages in Elixir Phoenix to change the state of a React component?
[英]In Elixir, Phoenix, how to get session in other module as a module use Phoenix.Channel?
在 Elixir 和 Phoenix 中,我可以通过以下方式在 Controller 中获取会话
Plug.Conn.get_session(conn, :id)
那么如何在其他模块中获取会话作为一个模块使用Phoenix.Channel
呢?
Plug.Conn
在Phoenix.Channel
不可用。 通道依赖Phoenix.Socket
而您可以使用Phoenix.Token
进行身份验证。
这是有关如何在 Phoenix 中验证频道的教程。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.