Broadcasting from a Controller possible?
fuchsberger opened this issue · comments
I am wondering if there is a way to broadcast an event (e.g. a Socket |> update!()) from within a contoller action?
Use case: Some of my controller actions create new post entries and I would like to update the UI with drab for specific sockets as a result.
PS: I am truly amazed by the simplicity, functionality and novelty of your approach. I have been able to replace almost everything from a react frontend back into Phoenix.
Found #143 addresses same issue
In every broadcasting function you might use a subject instead of socket, where subject may be something like same_controller(MyApp.MyController
. Please refer to the documentation.
BTW broadcast_poke
is broken now, it does not work with subject. But it will.