Skip to content

Design and sizing for WebSocket support #9507

@srawlins

Description

@srawlins

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?

  1. Scaffolding was added to dart:io and the VM service to support profiling, including an _HttpProfile class. dart-lang/sdk@558875d
  2. Hooks were added to dart:io to allow HttpClient.enableTimelineLogging to be set remotely. dart-lang/sdk@93c9eba
  3. In dart:io and the VM service, a httpEnableTimelineLogging service extension was added. dart-lang/sdk@e85e5b6
  4. In dart:io and the VM service, HTTP network profiling services were added. dart-lang/sdk@c4bfca9
  5. Added APIs to dart:developer to record and retrieve HTTP profile info. dart-lang/sdk@628d744
  6. A skeleton http_profile package was added: dart-lang/http@04777ac
  7. The http_profile package was fleshed out: dart-lang/http@ce0de37
  8. More API in the http_profile package. dart-lang/http@5dfea72, dart-lang/http@9f47439
  9. Integrate cupertino_http with the http_profile package. dart-lang/http@46d49e3
  10. 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:

WebSocket plan

  1. Update HttpClient.enableTimelineLogging to also start recording WebSocket details. This involves dart:developer, dart:io.
  2. Add support for sending this recorded data in the VM service extensions.
  3. Add support in the http_profile package.
  4. Integrate with cupertino_http package, web_socket package (maybe web_socket_channel package?).
  5. Add support to DevTools.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2important to work on, but not at the top of the work list.enhancementNew feature or requestscreen: networkIssues with the Network screen.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions