844 B · text History 9c0fc16
defmodule LambentExWeb.UserSocket do
  @moduledoc """
  Socket for native clients. One channel per section of the web ui,
  each forwarding the same pubsub the matching liveview subscribes to and
  accepting the same controls it renders.

  Unauthenticated on purpose: this is the same posture as the web ui, which
  is a lan appliance with no user model. Do not put it on the internet.
  """

  use Phoenix.Socket

  channel "devices", LambentExWeb.DevicesChannel
  channel "machines", LambentExWeb.MachinesChannel
  channel "links", LambentExWeb.LinksChannel
  channel "services", LambentExWeb.ServicesChannel
  channel "brightness", LambentExWeb.BrightnessChannel

  @impl true
  def connect(_params, socket, _connect_info), do: {:ok, socket}

  # anonymous sockets, so nothing to address them by
  @impl true
  def id(_socket), do: nil
end