Packages

Multi-surface application runtime for Elixir. One TEA module renders to terminal, browser (LiveView), SSH, and MCP (agents). 30+ widgets, flexbox + CSS grid, AI agent runtime, distributed swarm with CRDTs, time-travel debugging, session recording, sandboxed REPL, and agentic commerce.

Current section

Files

Jump to
raxol lib raxol_web channels user_socket.ex
Raw

lib/raxol_web/channels/user_socket.ex

defmodule RaxolWeb.UserSocket do
use Phoenix.Socket
require Raxol.Core.Runtime.Log
# Channels
channel("terminal:*", RaxolWeb.TerminalChannel)
channel("user:*", RaxolWeb.UserChannel)
# Socket configuration
@impl true
def connect(%{user_id: user_id} = _params, socket, _connect_info) do
Raxol.Core.Runtime.Log.info(
"Connecting user with atom key user_id: #{user_id}"
)
{:ok, assign(socket, :user_id, user_id)}
end
def connect(_params, socket, _connect_info) do
# Allow anonymous connections
{:ok, socket}
end
@doc """
Identifies the socket connections.
"""
@impl true
def id(socket), do: "user_socket:" <> socket.assigns.user_id
end