WiretapKMP is a drop-in network inspector and mocker for Kotlin Multiplatform apps. Add one dependency, install the plugin, and inspect every HTTP request, WebSocket message, and SSE event β or mock and throttle them β all from a built-in UI. No proxy needed.
Early Preview β We're looking for early adopters and feedback! Open an issue or start a discussion.
π Quick Start
// Ktor
val client = HttpClient {
install(WiretapKtorHttpPlugin)
}
// OkHttp
val client = OkHttpClient.Builder()
.addInterceptor(WiretapOkHttpInterceptor())
.build()
That's it. Open your app and shake the device (or press Ctrl+Shift+D on desktop) to launch the inspector.
β What You Get
| HTTP | WebSocket | SSE | |
|---|---|---|---|
| Ktor | β | β | β |
| OkHttp | β | β | β |
| URLSession | β | β | β |
| Android | iOS | JVM Desktop | |
|---|---|---|---|
| Ktor | β | β | β |
| OkHttp | β | β | β |
| URLSession | β | β | β |
πΈ Screenshots
| Overview | Request | Response |
|---|---|---|
![]() |
![]() |
![]() |
| WebSocket | Messages | Notifications |
|---|---|---|
![]() |
![]() |
![]() |
β Key Features
- Zero-config logging β install the plugin and all traffic is captured automatically
- API mocking β return fake responses without hitting the network. Match on method, URL, headers, and body
- Request throttling β simulate slow connections with fixed or random delays
- Header masking β redact
Authorization,Cookie, or any sensitive header from logs - Shake to launch β built-in gesture to open the inspector (no UI code required)
- No-op variants β swap to
wiretap-ktor-noop/wiretap-okhttp-noopfor release builds with zero overhead - Share as file β export any log entry via the platform share sheet
More screenshots
API Mocking & Rules Engine
| Mocked Requests | Mock Rule | Rules List |
|---|---|---|
![]() |
![]() |
![]() |
List-Detail Pane (Tablet / Desktop)
π‘ SSE Inspection (Experimental)
WiretapKMP can inspect Server-Sent Events (SSE) streams β log every connection, event, and status change right alongside your HTTP and WebSocket traffic.
β οΈ SSE inspection is in early preview. APIs are marked with
@ExperimentalWiretapSseApiand may change in future releases.
Ktor
Install the SSE plugin β sessions are wrapped automatically:
@OptIn(ExperimentalWiretapSseApi::class)
val client = HttpClient {
install(SSE)
install(WiretapKtorSsePlugin) // SSE logging
install(WiretapKtorHttpPlugin) // HTTP logging
}
client.sse("https://api.example.com/stream") {
incoming.collect { event ->
println("Event: ${event.event} β ${event.data}")
}
}
OkHttp
Wrap your EventSourceListener with .wiretapped():
val client = OkHttpClient.Builder()
.addInterceptor(WiretapOkHttpInterceptor())
.build()
val request = Request.Builder().url("https://api.example.com/stream").build()
val factory = EventSources.createFactory(client)
@OptIn(ExperimentalWiretapSseApi::class)
factory.newEventSource(request, myListener.wiretapped())
What Gets Logged
| Connection | Events |
|---|---|
| URL, headers, status (Open β Closed/Failed), timestamps | Event type, data payload, event ID, byte count, timestamp |
For full details, see the Ktor SSE guide and OkHttp SSE guide.
π¦ Installation
// build.gradle.kts
debugImplementation("dev.skymansandy:wiretap-ktor:1.0.0-RC15")
releaseImplementation("dev.skymansandy:wiretap-ktor-noop:1.0.0-RC15")
// or for OkHttp
debugImplementation("dev.skymansandy:wiretap-okhttp:1.0.0-RC15")
releaseImplementation("dev.skymansandy:wiretap-okhttp-noop:1.0.0-RC15")
For full setup including URLSession and advanced configuration, see the Getting Started guide.
π Documentation
Full docs Β· Getting Started Β· API Reference
π€ Contributing
Contributions are welcome! Fork the repo, create a feature branch, and open a PR.
π Acknowledgements
Kotlin Multiplatform Β· Compose Multiplatform Β· Ktor Β· Room Β· Koin Β· OkHttp Β· SKIE Β· KMMBridge








