PhoenixReplay.Recorder (PhoenixReplay v0.2.0)

Copy Markdown View Source

LiveView lifecycle hook that records session state transitions.

Usage as on_mount hook

live_session :default, on_mount: [PhoenixReplay.Recorder] do
  live "/dashboard", DashboardLive
end

Manual attachment

def mount(_params, _session, socket) do
  {:ok, PhoenixReplay.Recorder.attach(socket)}
end

Summary

Functions

Manually attach recording to a socket. Use when not using on_mount.

on_mount callback. Automatically attaches recording hooks.

Functions

attach(socket, params \\ %{}, session \\ %{})

Manually attach recording to a socket. Use when not using on_mount.

Pass params and session from your mount/3 to capture them in the recording. If omitted, they are recorded as empty maps.

Examples

def mount(params, session, socket) do
  {:ok, PhoenixReplay.Recorder.attach(socket, params, session)}
end

on_mount(atom, params, session, socket)

on_mount callback. Automatically attaches recording hooks.