The dashboard as a Phoenix LiveView — the browser transport.
Available when the optional phoenix_ex_ratatui
dependency is present; without it this module is not compiled. Add it
next to bb_tui:
{:bb_tui, "~> 0.6"},
{:phoenix_ex_ratatui, "~> 0.2"}Define a LiveView and route to it like any other:
defmodule MyAppWeb.RobotLive do
use BB.TUI.Live, robot: MyApp.Robot
end
# router.ex
live "/robot", MyAppWeb.RobotLiveThe use options are the dashboard's mount options — the same keyword
list BB.TUI.start/2 takes (:robot is required; :node,
:subscribe_paths, and :renderers pass through). For per-session
options — picking the robot from the session or params — override
tui_mount_opts/1, which receives the LiveView socket after mount:
defmodule MyAppWeb.RobotLive do
use BB.TUI.Live, robot: MyApp.Robot
def tui_mount_opts(socket) do
[robot: socket.assigns.robot]
end
endEach browser connection runs its own isolated dashboard session over
the shared robot, exactly as concurrent SSH clients do. The JS side
needs phoenix_ex_ratatui's hook registered once in app.js — see
the phoenix_ex_ratatui docs
and the dev/web demo endpoint in this repository for the wiring.