phoenix-liveview
Installation
SKILL.md
Phoenix LiveView Patterns
LiveView Lifecycle
A LiveView goes through two phases:
- Static Mount: Initial HTTP request (connected?: false)
- Connected Mount: WebSocket upgrade (connected?: true)
def mount(_params, _session, socket) do
if connected?(socket) do
# Subscribe to topics, start timers, etc.
Phoenix.PubSub.subscribe(MyApp.PubSub, "topic")
end
{:ok, assign(socket, :data, [])}
end