mirror of
https://github.com/fly-apps/live_beats.git
synced 2024-12-11 01:36:36 +00:00
32 lines
572 B
Elixir
32 lines
572 B
Elixir
|
defmodule Phoenix.Presence.Client.PresenceMock do
|
||
|
|
||
|
use GenServer
|
||
|
alias Phoenix.Presence.Client
|
||
|
|
||
|
|
||
|
def start_link(opts \\ []) do
|
||
|
GenServer.start_link(__MODULE__, opts[:id], opts)
|
||
|
end
|
||
|
|
||
|
@impl true
|
||
|
def init(id) do
|
||
|
{:ok, %{id: id}}
|
||
|
end
|
||
|
|
||
|
def track(pid, topic, key) do
|
||
|
GenServer.cast(pid, {:track, topic, key})
|
||
|
end
|
||
|
|
||
|
@impl true
|
||
|
def handle_info(:quit, state) do
|
||
|
IO.inspect(:quit)
|
||
|
{:stop, :normal, state}
|
||
|
end
|
||
|
|
||
|
@impl true
|
||
|
def handle_cast({:track, topic, key}, state) do
|
||
|
Client.track(topic, key, %{})
|
||
|
{:noreply, state}
|
||
|
end
|
||
|
end
|