Starts the Mob dev server and opens it in the browser.
mix mob.server
mix mob.server --port 4040 # default port
mix mob.server --local # listen on 127.0.0.1 only; no LAN URL or QR codeThe server provides:
- Live device status cards (Android + iOS simulator)
- Per-device deploy buttons ("Update" and "First Deploy")
- Streaming log panel (logcat / iOS simulator console)
Access token
By default the server listens on every interface so a phone on the same
network can open it from the printed QR code. Each run generates a random
access token and a random secret_key_base; the printed URLs and the QR code
carry the token as ?token=.... A browser that opens one of them gets a
signed session cookie for that run. Any request without it is refused with
401, and the LiveView socket refuses to connect. Restarting the server
invalidates every earlier link and cookie.
The server runs until you press Ctrl+C.
For an interactive IEx session alongside the dashboard:
iex -S mix mob.serverUnder the hood
mix mob.server starts a Phoenix + Bandit supervision tree directly in the
Mix process — equivalent to iex -S mix phx.server for a Phoenix app, except
it starts the supervisor inline rather than through the application callback:
Application.ensure_all_started(:bandit)
Application.ensure_all_started(:phoenix_live_view)
Supervisor.start_link([
{Phoenix.PubSub, name: MobDev.PubSub},
MobDev.Server.Endpoint, # Bandit HTTP server on port 4040
MobDev.Server.DevicePoller, # polls adb + xcrun simctl
MobDev.Server.LogStreamerSupervisor, # logcat / simctl log streams
MobDev.Server.WatchWorker, # optional file-watch loop
...
], strategy: :one_for_one)
open "http://localhost:4040/?token=<per-run token>" # macOS: open, Linux: xdg-openThe endpoint uses Bandit.PhoenixAdapter instead of Cowboy, so there is no
:plug_cowboy dependency. Everything else is standard Phoenix LiveView.