// use case

Expose your Phoenix LiveView app on a public URL

mix phx.server runs on localhost:4000. LiveView keeps a WebSocket open for every connected client. lrok forwards the WS plus everything else over the same tunnel.
  1. Run Phoenix

    $ mix phx.server
  2. Tunnel

    $ lrok http 4000
  3. check_origin in endpoint

    In config/dev.exs: config :my_app, MyAppWeb.Endpoint, check_origin: ["https://*.lrok.io"]. Otherwise LiveView rejects the WebSocket on origin mismatch.

// why lrok for this

LiveView sends one WebSocket frame per DOM change. Tunnels that buffer or batch frames cause UI lag. lrok forwards WS frames immediately.

Related workflows