start

fun start(bind: SnoopBind = SnoopBind.Local, port: Int = DEFAULT_PORT, token: String? = null): String

Start the server (idempotent, thread-safe). Returns the URL you'd actually open: lanUrl when reachable off-device, otherwise the local url — token always included.

The bind itself is asynchronous: this returns before the port is actually listening, so a failure (port taken, restricted environment) surfaces afterwards as a warning in Logcat/the device console, with isRunning flipped back to false. The same URL is logged on success, so the token is always recoverable from the log. A call that races a live or still-stopping server is discarded and returns that server's URL — isRunning is the source of truth.

Parameters

bind

where to listen. SnoopBind.Local (default) is loopback-only; SnoopBind.Lan and SnoopBind.Host are reachable off-device. All of them are token-gated.

token

forces this exact token instead of the generated one.