mix mob.server (mob_dev v0.3.37)

Copy Markdown View Source

Starts the Mob dev server and opens it in the browser.

mix mob.server
mix mob.server --port 4040   # default port

The server provides:

  • Live device status cards (Android + iOS simulator)
  • Per-device deploy buttons ("Update" and "First Deploy")
  • Streaming log panel (logcat / iOS simulator console)

The server runs until you press Ctrl+C.

For an interactive IEx session alongside the dashboard:

iex -S mix mob.server

Under 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"       # macOS: open, Linux: xdg-open

The endpoint uses Bandit.PhoenixAdapter instead of Cowboy, so there is no :plug_cowboy dependency. Everything else is standard Phoenix LiveView.