mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-01-04 06:01:59 +08:00
4334e8a58e
Co-authored-by: José Valim <jose.valim@dashbit.co>
20 lines
451 B
Elixir
20 lines
451 B
Elixir
defmodule LivebookWeb.Socket do
|
|
use Phoenix.Socket
|
|
|
|
channel "js_view", LivebookWeb.JSViewChannel
|
|
|
|
@impl true
|
|
def connect(_params, socket, info) do
|
|
# The session is present only if the CSRF token is valid. We rely
|
|
# on CSRF token, because we don't check connection origin as noted
|
|
# in LivebookWeb.Endpoint.
|
|
if info.session do
|
|
{:ok, socket}
|
|
else
|
|
:error
|
|
end
|
|
end
|
|
|
|
@impl true
|
|
def id(_socket), do: nil
|
|
end
|