Reputation: 2896
Is there a way to broadcast a message to a channel from outside that channel?
Maybe something like Channel.broadcast topic, event, data
?
I saw something like this here but the final version of Phoenix.Channel.broadcast/3
(as of today) takes a socket which implies the channel and topic.
Upvotes: 31
Views: 11757
Reputation: 1462
You can use MyApp.Endpoint.broadcast(topic, event, msg)
for that.
Check http://hexdocs.pm/phoenix/Phoenix.Endpoint.html
Upvotes: 68