Skip to content

Instantly share code, notes, and snippets.

@graeme-hill
graeme-hill / AsyncSocket.ex
Created August 13, 2017 01:29
Helper GenServer for testing multiple phoenix channels clients at the same time
defmodule AsyncSocket do
use GenServer
use MatchmakerApiWeb.ChannelCase
# Client
defmacro create_and_join(channel, topic, payload) do
if endpoint = Module.get_attribute(__CALLER__.module, :endpoint) do
quote do
{:ok, pid} = AsyncSocket.start_link(unquote(endpoint))