WiretapKMP
Kotlin Multiplatform library for network inspection and mocking. Intercept HTTP and WebSocket traffic, mock API responses, and throttle requests.
Install / Use
/learn @skymansandy/WiretapKMPREADME
Kotlin Multiplatform network inspection and mocking SDK. Intercept HTTP and WebSocket traffic, mock API responses, and throttle requests — no proxy server needed.
📸 Screenshots
HTTP Inspector
| Overview | Request | Response | |:--------:|:-------:|:--------:| | <img src="docs/art/screenshots/http/overview.png" width="260"/> | <img src="docs/art/screenshots/http/request.png" width="260"/> | <img src="docs/art/screenshots/http/respose.png" width="260"/> |
WebSocket Inspector
| Connections | Messages | |:-----------:|:--------:| | <img src="docs/art/screenshots/socket/socketlist.png" width="260"/> | <img src="docs/art/screenshots/socket/socketdetail.png" width="260"/> |
API Mocking & Throttling
| Mocked Requests | Mocked Response | Mock Rule | Throttle Rule | Mock + Throttle | |:---------------:|:---------------:|:---------:|:-------------:|:---------------:| | <img src="docs/art/screenshots/http/mocked requests.png" width="200"/> | <img src="docs/art/screenshots/http/mocked_response.png" width="200"/> | <img src="docs/art/screenshots/http/just mock.png" width="200"/> | <img src="docs/art/screenshots/http/throttle only.png" width="200"/> | <img src="docs/art/screenshots/http/mock+throttle.png" width="200"/> |
Rules Engine
| Swipe to Create | Request Setup | Response Setup | Rules List | Rule Details | |:---------------:|:-------------:|:--------------:|:----------:|:------------:| | <img src="docs/art/screenshots/http/swipetocreaterule.png" width="200"/> | <img src="docs/art/screenshots/http/rulecreate-requestsetup.png" width="200"/> | <img src="docs/art/screenshots/http/rulecreate-responsesetup.png" width="200"/> | <img src="docs/art/screenshots/http/ruleslist.png" width="200"/> | <img src="docs/art/screenshots/http/rule-view.png" width="200"/> |
Notifications
| HTTP | WebSocket | |:----:|:---------:| | <img src="docs/art/screenshots/http/notification.png" width="300"/> | <img src="docs/art/screenshots/socket/notification.png" width="300"/> |
List-Detail Pane (Tablet / Desktop)
<img src="docs/art/screenshots/listdetailpane.png" width="600"/>📱 Platforms
KMP Plugins
| Client | Android | iOS | JVM Desktop | |--------|:-------:|:---:|:-----------:| | Ktor | ✅ | ✅ | ✅ | | OkHttp | ✅ | — | ✅ |
Swift UrlSession
| Client | iOS | |-----------------------|:---:| | WiretapURLSession | ✅ |
wiretap-urlsession is a dedicated Swift wrapper exported as an XCFramework via KMMBridge/SPM.
✨ Features
- API Mocking — Return fake responses without hitting the network. Match on method, URL, headers, and body.
- Request Throttling — Add artificial delay with fixed or random ranges.
- HTTP Logging — Capture URL, method, headers, bodies, status codes, duration, TLS details (OkHttp).
- WebSocket Logging — Full lifecycle tracking with message capture for Ktor and OkHttp.
- Header Masking — Keep, mask, or skip headers from logs.
- Log Retention — Forever, per app session, or time-based auto-pruning.
- Built-in Inspector UI — Compose Multiplatform UI for browsing logs, WebSocket streams, and managing rules.
- No-op Variants — Drop-in release replacements with zero overhead.
📖 Plugin Documentation
Each plugin module has its own README with detailed setup, configuration, usage examples, WebSocket support, and mock/throttle rules:
| Plugin | Platforms | README |
|-----------------------|-------------------|-----------------------------------------------------------------|
| Ktor | Android, iOS, JVM | wiretap-ktor/README.md |
| OkHttp | Android, JVM | wiretap-okhttp/README.md |
| WiretapURLSession | iOS | wiretap-urlsession/README.md |
🔇 No-op Variants
Swap dependencies for release builds — no conditional code needed.
| Debug | Release |
|------------------|------------------------|
| wiretap-ktor | wiretap-ktor-noop |
| wiretap-okhttp | wiretap-okhttp-noop |
For URLSession, use WiretapURLSession in debug and plain URLSession in release (see installation above).
📚 Documentation
🤝 Contributing
Contributions are welcome! Here's how to get started:
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-feature) - Commit your changes (
git commit -m 'Add my feature') - Push to the branch (
git push origin feature/my-feature) - Open a Pull Request
🙏 Acknowledgements
- JetBrains — for Kotlin Multiplatform, Compose Multiplatform, and Ktor
- Android Jetpack — for Room, App Startup, and Compose
- Koin — lightweight dependency injection for KMP
- OkHttp — by Square, for the HTTP client and interceptor APIs
- SKIE — by Touchlab, for Swift-friendly KMP interop
- KMMBridge — by Touchlab, for SPM publishing of KMP frameworks
📄 License
Copyright 2025 skymansandy
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Related Skills
ai-cmo
Collection of my Agent Skills and books.
next
A beautifully designed, floating Pomodoro timer that respects your workspace.
product-manager-skills
38PM skill for Claude Code, Codex, Cursor, and Windsurf: diagnose SaaS metrics, critique PRDs, plan roadmaps, run discovery, and coach PM career transitions.
devplan-mcp-server
3MCP server for generating development plans, project roadmaps, and task breakdowns for Claude Code. Turn project ideas into paint-by-numbers implementation plans.
