Repository navigation
Description
When an app makes WebSocket requests via dart:io's WebSocket class, the requests appear in the Network Screen as opaque 'SOCKET' requests. Users have requested first-class WebSocket support, much like the existing HTTP support (#8223).
This would be a sizable effort. The goal of this issue is to flesh out the work a bit, and size it.
HTTP support
How was support implemented for HTTP requests?
- Scaffolding was added to dart:io and the VM service to support profiling, including an
_HttpProfileclass. dart-lang/sdk@558875d - Hooks were added to dart:io to allow
HttpClient.enableTimelineLoggingto be set remotely. dart-lang/sdk@93c9eba - In dart:io and the VM service, a
httpEnableTimelineLoggingservice extension was added. dart-lang/sdk@e85e5b6 - In dart:io and the VM service, HTTP network profiling services were added. dart-lang/sdk@c4bfca9
- Added APIs to dart:developer to record and retrieve HTTP profile info. dart-lang/sdk@628d744
- A skeleton http_profile package was added: dart-lang/http@04777ac
- The http_profile package was fleshed out: dart-lang/http@ce0de37
- More API in the http_profile package. dart-lang/http@5dfea72, dart-lang/http@9f47439
- Integrate cupertino_http with the http_profile package. dart-lang/http@46d49e3
- Integrate cronet_http with the http_profile package. dart-lang/http@4726f43
What will be required for WebSocket requests?
In very broad strokes, the support required for HTTP requests included (1) support in dart:io's HttpClient, (2) support in the VM service, (3) support in dart:developer, (4) shared types in a new http_profile package, (5) integration in several other HTTP-related packages, (6) support in DevTools. At a glance, it looks like we need to make similar changes to each of these 6 areas in order to support WebSocket requests. Can it be reduced? For example, do we need a new web_socket_profile package, or can we piggy-back off of the http_profile package?
@bkonyi You allude to this question here. I think we would want to make the support generic, and add to the http_profile package. This is primarily because there has been much recent movement in this space a la @brianquinlan 's work:
- the web_socket_channel package,
- the web_socket package (and some integrations, dart-lang/http@01817d2, dart-lang/http@caad9ca, dart-lang/http@199f9fa), and
- first-class support in the cupertino_http package, a la CupertinoWebSocket.
WebSocket plan
- Update HttpClient.enableTimelineLogging to also start recording WebSocket details. This involves dart:developer, dart:io.
- Add support for sending this recorded data in the VM service extensions.
- Add support in the http_profile package.
- Integrate with cupertino_http package, web_socket package (maybe web_socket_channel package?).
- Add support to DevTools.
Activity
Victowolf commentedon Feb 21, 2026
Hi @srawlins,
I’m Yash (VictoWolf) ,
Continuing the discussion from #9670,
I started with retracing the http support to understand how it was implemented, by following the above explanation given in this issue.
I was able to create a flow:
I also mapped them to folders/file where they are implemented.
Now for implementing WebSocket, i first noted down what all is already implemented for WebSockets.
what i found was:
websocket.dart" sdk/lib/_http/ "websocket_impl.dart" sdk/lib/_http/ "They currently handle handshakes, Frame encoding/decoding, Ping/pong & Close frames.
But there is no profiling instrumentation like
_HttpProfileData, no VM extension like:ext.dart.io.getWebSocketProfileThis makes WebSocket traffic not surfaced in DevTools with protocol semantics (e.g., lifecycle or frame-level visibility).
To accommodate WebSocket we can probably
The above plan follows for:
For gRPC, as included in the GSOC project list, Still have to learn about it. 😅
So, To proceed further with Sample project i wanted to clarify whether my above understanding is in right direction...?
Thanks....
Victowolf commentedon Feb 23, 2026
Hi @elliette,
After the recent update to the project list.
I was creating plan for building the Sample project.
I came across 2 approaches:
Approach 1
Create a simple
ProfileableWebSocketwrapper that interceptsadd()for outgoing messages and useslisten()for incoming messages.Approach 2
Use a
StreamTransformerto compose incoming logging via a transformed stream (e.g.,customStream.listen()), and still interceptadd()separately for outgoing messages.The 2nd approach gives more composable incoming from a Stream perspective. but have to implement
add()for outgoing.For the prototype, I am thinking to go with approach 1, so i need some guidance here .
I also wanted to add some extra features to the prototype, these are:
Lifecycle style hooking which will give more debugging info
add()→ message sentlisten()→ message receivedonDone→ close eventonError→ error eventMy goal is to demonstrate lifecycle capture without modifying SDK internals.
Connection Based Loging which will give a complete summary like
For the sample project would you prefer the above additions ?
Thanks,
elliette commentedon Feb 23, 2026
Hi @Victowolf - this issue isn't being actively monitored, so for questions the best place to ask is https://groups.google.com/g/dart-gsoc.
For your first question, please see this thread
For your second question, you are welcome to add extra functionality to the starter project, those both sound like useful metrics to capture.
Hope that helps! Please direct further questions to https://groups.google.com/g/dart-gsoc. Thanks!
Victowolf commentedon Feb 24, 2026
ok sure,
That helps a lot..
Thanks.
abdullah-arain9 commentedon Mar 30, 2026
Hi Samuel,
I am Abdullah Arain, a GSoC 2026 applicant
for this project. I have studied this issue
thoroughly along with all the HTTP profiling
commits you referenced above.
Based on your HTTP profiling implementation
path, I built a working prototype that
demonstrates the WebSocket instrumentation
approach:
github.com/abdullah-arain9/websocket-devtools-profiler
Key achievements:
dart:io WebSocket interface as a drop-in
replacement
Timeline.instantSync() — same mechanism
as HTTP profiling today
— no network required
My proposal follows your suggested plan exactly:
for WebSocket
GSoC 2026 proposal submitted. Would love
any feedback before the deadline!
— Abdullah Arain
github.com/abdullah-arain9