Add network request monitoring#16
Merged
Merged
Conversation
- Add DevFlowHttpHandler (DelegatingHandler) for HTTP traffic interception
- Auto-inject via ConfigureHttpClientDefaults in AddMauiDevFlowAgent()
- Add NetworkRequestStore ring buffer (default 500 entries) with events
- Add DevFlowHttp static helper for non-DI HttpClient wrapping
- Add REST endpoints: /api/network, /api/network/{id}, /api/network/clear
- Add WebSocket endpoint /ws/network for real-time streaming with replay
- Add RFC 6455 WebSocket support to AgentHttpServer (upgrade, frames, ping/pong)
- Add CLI commands: MAUI network (live monitor), network list, network detail, network clear
- Add --json flag for JSONL streaming output (AI-friendly)
- Add --host and --method filter options
- Add Spectre.Console for rich terminal output
- Add NetworkTestPage to SampleMauiApp for testing
- Capture request/response headers, bodies (256KB limit), timing, status
- Tested on Mac Catalyst, Android, and iOS
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add TCP keepalive on WebSocket connections to prevent OS idle drops - Add server-side WebSocket ping every 15 seconds - Add auto-reconnect in CLI network monitor with '(reconnected)' indicator - Improve error handling: don't crash on malformed JSON messages Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Upgrade CLI from net9.0 to net10.0 (C# 14) for XenoAtom.Terminal.UI - Add XenoAtom.Terminal.UI v1.1.1 package - Implement NetworkMonitorTui with DataGrid, detail view, keyboard nav - DataGrid shows: Index, Method, URL, Status, Duration, Size, ContentType - Enter key fetches full request/response details from agent API - Color-coded status codes (green 2xx, yellow 3xx, red 4xx/5xx) - WebSocket auto-reconnect with status indicator - --json flag falls back to JSONL streaming mode Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Replace Terminal.Run with TerminalApp for proper dispatcher integration - Use app.Post() for all UI state mutations from WebSocket background thread - Remove State<bool> exit check from WS loop (was blocking on non-UI thread) - Use CancellationToken exclusively for shutdown signaling Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…cking - Replace single-pane Enter-to-detail view with HSplitter split-pane layout - Remove ScrollViewer wrapper around DataGrid (was stealing keyboard events, causing CurrentCell.Row to always return -1) - Replace computed bindings with explicit State<string> to fix ProcessBindingWrites crash (Collection was modified during enumeration) - Wrap DataGrid document mutations in BeginUpdate() for batch safety - Remove index re-numbering loop that triggered binding write storms - Details pane auto-updates on arrow key navigation and mouse click Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Wire up ConfigureHttpClientDefaults with DevFlowHttpHandler in GtkAgentServiceExtensions, matching the standard MAUI agent setup. Add Microsoft.Extensions.Http package reference. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Link NetworkTestPage.xaml and code-behind from SampleMauiApp. Register AddHttpClient() and AddTransient<NetworkTestPage>() in Linux MauiProgram.cs to match the main app's DI configuration. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1a15c61 to
affd932
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…OS app - Add early JS-side check for window.__chobitsuDebugEnabled in InjectDebugScriptCoreAsync to skip re-injection when Shell navigation recreates the native WebView but shares the JS process pool - Add same-instance guard in mapper callbacks for iOS, macOS, and Android to prevent redundant OnWebViewCapturedAsync calls from property mapping - Add missing NetworkTestPage linked files to SampleMauiApp.MacOS.csproj Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Network Request Monitoring
Adds comprehensive HTTP traffic interception and monitoring to MauiDevFlow, enabling developers to observe all HTTP requests their MAUI app makes in real-time.
Architecture
What's Included
Agent Core (in-app):
DevFlowHttpHandler— DelegatingHandler that wraps platform handlers (AndroidMessageHandler, NSUrlSessionHandler, etc.)NetworkRequestStore— Thread-safe ring buffer (default 500 entries) withOnRequestCapturedeventConfigureHttpClientDefaultsinAddMauiDevFlowAgent()— zero config for DI clientsDevFlowHttp.CreateClient()helper for non-DI HttpClients/api/network,/api/network/{id},/api/network/clear/ws/networkwith replay + live streamingAgentHttpServer:
MapWebSocket()route registration alongside MapGet/MapPostCLI Commands:
MAUI network— Live TUI monitor (streams requests in real-time)MAUI network --json— JSONL streaming (one JSON object per line, AI-friendly)MAUI network list [--host H] [--method M] [--json]— One-shot dumpMAUI network detail <id>— Full headers + body for a specific requestMAUI network clear— Clear captured bufferSample App:
NetworkTestPagewith buttons to make test HTTP requests (GET, POST, 404, error)Testing
Tested on:
Key Design Decisions
CI