SnoopWebServer

A tiny embedded HTTP server that serves the Snoop timeline as a live web page, so you can inspect traffic from a desktop browser while debugging.

Binds loopback by default (SnoopBind.Local: adb forward tcp:9394 on Android; localhost:9394 on the iOS simulator, which shares the host loopback). Pass SnoopBind.Lan to reach a physical device from your Mac over Wi-Fi. Every bind is token-gated — loopback included, since it is shared with every other app on the device. Reads the same shared SnoopCore store the on-device UI uses.

Properties

Link copied to clipboard
const val DEFAULT_PORT: Int = 9394
Link copied to clipboard
Link copied to clipboard

The access token every request must carry as ?t=, or null when no server is running.

Link copied to clipboard
val url: String

The URL for local access, token included.

Functions

Link copied to clipboard
fun lanUrl(): String?

The URL to reach this device from another machine on the LAN, or null on a SnoopBind.Local bind (nothing off-device) or when no LAN address is available. Includes the token.

Link copied to clipboard
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.

Link copied to clipboard
fun stop()