0

I have a phoenix channel that does push result on a handle_info after a handle_in instead of replying right away (don't ask why please, I have a use-case). The example below would be similar to my case.

def handle_in("topic", %{"param" => param}, socket) do
    ... do something here ...
    send self(), %{:on_topic, result}
    {:noreply, socket}
end

def handle_info({:on_topic, result}, socket) do
    ... do something here ...
    push socket, "topic_resp", %{resp: result}
    {:noreply, socket}
end

So far I'm able to test the handle_in easily (since there is no reply), but how to wait and test the result of the socket push after handle_info?

Kunto Fullstack
  • 405
  • 6
  • 16

0 Answers0