Hi all,
I’ve been studying the current HTTP profiling pipeline in the Dart VM and DevTools to understand how WebSocket support could integrate cleanly.
From my investigation:
HTTP profiling is implemented via a VM-side HttpProfiler that stores request data per isolate and exposes it through service extensions.
DevTools periodically polls this profile and merges HTTP and Socket data into a unified NetworkRequest list.
There is currently no VM-level instrumentation for WebSocket frames; only the initial HTTP handshake and raw socket byte statistics are available.
Based on this, my proposed direction is:
Add WebSocket frame-level instrumentation within dart:_http at the _WebSocketProtocolTransformer (incoming) and _WebSocketOutgoingTransformer (outgoing) layers.
Introduce a polling-based service extension (e.g., getWebSocketProfile) modeled after getHttpProfile.
Integrate the returned data into the existing NetworkController merge pipeline as a new WebSocketConnection model displayed alongside HTTP and sockets.
Before proceeding further, I wanted to clarify two points:
Is frame-level inspection (individual frames with direction and size metadata) within the intended scope of this project?
Should the VM integration follow the same polling-based model as HTTP profiling, or is there interest in exploring a stream-based reporting mechanism for WebSocket traffic?
I’d appreciate any guidance on whether this aligns with expectations.
Best,
Rishika