I want to send an Event from liveView server to the Client, with this funtion:
def handle_event("test", _, socket) do
{:noreply, push_event(socket, "testEvent", %{coins: 23, user: "user"})}
end
This is explained very similar in the docs of liveview. https://hexdocs.pm/phoenix_live_view/js-interop.html But i get this error message:
(CompileError) undefined function push_event/3
Stacktrace:
│ (elixir 1.10.4) src/elixir_locals.erl:114: anonymous fn/3 in :elixir_locals.ensure_no_undefined_local/3
│ (stdlib 3.8) erl_eval.erl:680: :erl_eval.do_apply/6
have i missed some inmport? or what I am doing wrong?
I think the Problem was my version of live view. I had to upgrade:
{:phoenix_live_view, "~> 0.13.0"},
to:
{:phoenix_live_view, "~> 0.14.4"},