有没有办法从 channel 外向 channel 广播消息?
也许像 Channel.broadcast topic, event, data
?
我看到这样的 here但是Phoenix.Channel.broadcast/3
的最终版本(截至今天)接受一个暗示 channel 和主题的套接字。
最佳答案
您可以使用 MyApp.Endpoint.broadcast(topic, event, msg)
为了那个原因。
查询 http://hexdocs.pm/phoenix/Phoenix.Endpoint.html
关于elixir - 如何从 Phoenix Controller 向 channel 广播消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33960207/