-
Notifications
You must be signed in to change notification settings - Fork 362
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.