3

I understand that I can get the liveview to update by including something like:

if connected?(socket), do: :timer.send_interval(10000, self(), :click)

But, is there a way to trigger this from somewhere else in my application?

For example, if you are updating traffic stats, you only want to update the control when a new click has arrived.

cjm2671
  • 18,348
  • 31
  • 102
  • 161

1 Answers1

3

You can use the PubSub mechanism. E.g. set Phoenix.PubSub.subscribe on mount and broadcast in a click handle_event

RobChooses
  • 428
  • 3
  • 12