Drab: remote controlled frontend framework for Phoenix

Yes, you can give a topic to any broadcasting function instead of the socket.
And yes, to broadcast poke (update of an assign) you need to give all assigns values. The reason is very simple: every browser may have different state at the same time. Broadcasting poke overwrites all the states to the given one.
This is why I should not do a broadcasting version of poke. I recommend you to use traditional DOM updates (from Drab.Element for example) when broadcasting.
See Allow to broadcast using poke / peek · Issue #60 · grych/drab · GitHub for more.

It is not practical. The socket is just a struct, where the most important information is a PID of the channel process (and in case you are using Drab, the PID of the Drab process).
When browser is disconnected, channel and drab process dies.
There is an idea to replace socket with something more abstract, which identifies a browser. In this case you might send an update to the browser which is disconnected. See 54) ElixirConf US 2018 – Closing Keynote – Chris McCord - #76 by grych

Easy, just use Drab.exec_elixir() method from JS. See docs for Drab.Client.

2 Likes