about summary refs log tree commit diff
path: root/lib/rook_web/channels/share_channel.ex
diff options
context:
space:
mode:
authorMelonai <einebeere@gmail.com>2021-05-08 23:41:03 +0200
committerMelonai <einebeere@gmail.com>2021-05-08 23:41:03 +0200
commit09693b979efe3c9c7ea64f79d97a1f0b53f7c49e (patch)
tree13719bb4800c1510a70f96f3e81f96f80ef960a2 /lib/rook_web/channels/share_channel.ex
parent88c0fbf10145ddd4ccd10ee432b4ca1aadd96a91 (diff)
downloadrook-09693b979efe3c9c7ea64f79d97a1f0b53f7c49e.tar.zst
rook-09693b979efe3c9c7ea64f79d97a1f0b53f7c49e.zip
Socket connection and token fetching
Diffstat (limited to 'lib/rook_web/channels/share_channel.ex')
-rw-r--r--lib/rook_web/channels/share_channel.ex11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/rook_web/channels/share_channel.ex b/lib/rook_web/channels/share_channel.ex
new file mode 100644
index 0000000..fde0096
--- /dev/null
+++ b/lib/rook_web/channels/share_channel.ex
@@ -0,0 +1,11 @@
+defmodule RookWeb.ShareChannel do
+  use Phoenix.Channel
+
+  def join("share:" <> token, _params, socket) do
+    if token == socket.assigns[:token] do
+      {:ok, socket}
+    else
+      {:error, %{reason: "Wrong token."}}
+    end
+  end
+end