about summary refs log tree commit diff
path: root/lib/rook_web/channels/share_channel.ex
blob: 74549862528d2640f4a405c4d12a3f7a5bfab916 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
defmodule RookWeb.ShareChannel do
  use Phoenix.Channel

  def join("share:" <> token, _params, socket) do
    if token == socket.assigns[:token] do
      :ok = Rook.ShareMonitor.track(self(), token)
      {:ok, socket}
    else
      {:error, %{reason: "Wrong token."}}
    end
  end

  def handle_close(_requests) do
    # Notify all requests that share is gone.
  end
end