Skip to content

[Step 4] Update DevTools UI to show WebSocket dataΒ #8

Closed

Description

@Victowolf

Milestone 4 β€” DevTools UI Integration for WebSocket Inspection πŸ–₯️

This milestone focuses on integrating WebSocket profiling data into the Flutter DevTools Network screen to provide real-time visibility into persistent socket communication.

The goal is to extend the existing Network panel experience so WebSocket connections and frame activity can be inspected similarly to HTTP requests.

Objectives

  • Display WebSocket connections in the DevTools Network request table
  • Add a dedicated β€œFrames” section for WebSocket traffic
  • Show detailed frame-level information including:
    • Timestamp
    • Direction (sent/received)
    • Payload size
    • Payload preview/snippet
  • Extend DevTools networking models to support WebSocket data structures
  • Parse and render profiling data received from VM Service extensions
  • Maintain UI consistency with existing HTTP inspection workflows

Planned Implementation Areas

Technical Direction

The DevTools networking layer will be updated to recognize WebSocket profiling data and represent it using dedicated models or extensions to the existing network request models.

A new UI section for frame inspection will be introduced, enabling developers to inspect real-time message flow, connection lifecycle activity, and payload information directly inside DevTools.

This milestone delivers the user-facing inspection experience for WebSocket debugging and completes the end-to-end profiling workflow from the Dart SDK to DevTools.

Activity

  1. self-assigned this
    on May 6, 2026
  2. moved this from Backlog to Ready in Google Summer of Code 2026on Jul 27, 2026
  3. moved this from Ready to In progress in Google Summer of Code 2026on Aug 13, 2026
  4. Victowolf commented on Aug 13, 2026

    @Victowolf
    OwnerAuthor

    ENTRY DATE: 14/08/2026

    UI Mapping for devtools

    WebSocket connections will appear directly in the existing Network request table:

    Network field WebSocket value
    Method socket
    Address WebSocket URI
    Status Connection state
    Type WebSocket
    Duration Last updated timestamp βˆ’ connection timestamp
    Size Total bytes sent + received
    Timestamp Connection timestamp

    Selecting a WebSocket connection will open its inspection view with two tabs:

    Overview tab

    Displays connection-level profiling information:

    • URI
    • Connection state
    • Protocol
    • Bytes sent / received
    • Frames sent / received
    • Ping / Pong counts
    • Last updated timestamp

    Frames tab

    Displays the recorded WebSocket events in a table:

    Field Description
    Frame # Sequential frame/event number
    Direction Inbound / Outbound
    Event Connect, Open, Send, Receive, Ping, Pong, Close, Error
    Payload Size Size of the associated payload
    Timestamp Event timestamp
    Error Error type, when applicable

    Selecting an individual frame opens an expanded details view containing:

    • Frame number
    • Connection ID
    • URI
    • Direction
    • Event type
    • Opcode
    • Payload size
    • Timestamp
    • Error type, when applicable
    • Error message, when applicable
  5. Victowolf commented on Aug 17, 2026

    @Victowolf
    OwnerAuthor

    ENTRY DATE: 15/08/2026

    Updated Milestone 4 β€” WebSocket Integration into Flutter DevTools Network Panel

    Goal

    Integrate the completed WebSocket profiling backend into the Flutter DevTools Network screen.

    The goal is to make WebSocket connections appear as Network entries alongside existing HTTP and Socket entries, while providing WebSocket-specific inspection through:

    Overview | Frames
    

    The implementation will reuse the existing Network infrastructure rather than introducing a separate WebSocket screen or controller.


    Architecture

                             DART SDK
                                β”‚
                        WebSocketProfiler
                                β”‚
                                β–Ό
                           VM Service
                                β”‚
                   getWebSocketProfile()
                                β”‚
                                β–Ό
                         NetworkService
                                β”‚
                      updatedSince polling
                                β”‚
                                β–Ό
                        NetworkController
                                β”‚
                                β–Ό
                     CurrentNetworkRequests
                                β”‚
                     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                     β”‚          β”‚          β”‚
                     β–Ό          β–Ό          β–Ό
                    HTTP      Socket    WebSocket
                     β”‚          β”‚          β”‚
                     β–Ό          β–Ό          β–Ό
                 NetworkRequest implementations
                                β”‚
                                β–Ό
                           NetworkScreen
                           /           \
                          /             \
                         β–Ό               β–Ό
                 NetworkRequestsTable   Inspector
                                          β”‚
                                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                β–Ό                   β–Ό
                             Overview             Frames
                                β”‚                   β”‚
                         WebSocket stats      WebSocket events
    

    WebSocket Network Model

    A new DevTools WebSocket model will implement the existing NetworkRequest abstraction.

    It will wrap the VM Service WebSocket profiling models:

    WebSocketProfile
    WebSocketConnection
    WebSocketProfileEvent
    

    The model will expose the common Network properties required by the Network table:

    • Connection ID
    • URI
    • Method
    • Type
    • Connection status
    • Start timestamp
    • End timestamp
    • Duration
    • Bytes sent
    • Bytes received
    • Failure state
    • Connection state

    The WebSocket model will maintain the connection identity using its connection ID so that subsequent profile updates modify the existing Network entry rather than creating a new entry.


    Files to Change

    1. network_service.dart

    Responsibility

    Fetch WebSocket profiling data from VM Service during the existing Network polling cycle.

    Changes

    Add WebSocket profile refresh handling alongside the existing network data refresh.

    The service will call:

    getWebSocketProfile(isolateId, updatedSince: ...)
    

    for each isolate.

    It will maintain the timestamp required for incremental WebSocket updates so that subsequent refreshes request only newly updated profiling data.

    Conceptually:

    NetworkService.refreshNetworkData()
            β”‚
            β”œβ”€β”€ Refresh WebSocket profile
            β”œβ”€β”€ Refresh Socket profile
            └── Refresh HTTP profile
    

    The WebSocket profile returned by VM Service will then be passed to NetworkController.

    Also integrate WebSocket profile clearing with the existing clearData() flow.


    2. network_controller.dart

    Responsibility

    Coordinate Network data and maintain the state exposed to the Network UI.

    Changes

    Extend the Network traffic processing pipeline to accept WebSocket profiling data.

    The controller will pass WebSocket data to:

    CurrentNetworkRequests
    

    alongside HTTP and Socket data.

    The existing polling mechanism will be reused. No separate WebSocket polling timer will be introduced.

    The controller will continue to handle:

    • Selection
    • Filtering
    • Search
    • Polling
    • Clearing
    • Network data refresh notifications

    WebSocket connections will therefore participate in the same Network screen lifecycle as other Network entries.


    3. network_model.dart

    Responsibility

    Define the DevTools-side models representing Network requests.

    Changes

    Add a WebSocket-specific NetworkRequest implementation.

    Conceptually:

    NetworkRequest
        β”œβ”€β”€ DartIOHttpRequestData
        β”œβ”€β”€ Socket
        └── WebSocket
    

    The WebSocket model will:

    • Wrap WebSocket VM Service data.
    • Expose connection metadata through NetworkRequest.
    • Maintain connection state and statistics.
    • Maintain WebSocket events/frames.
    • Update itself when new profile data arrives.
    • Call notifyListeners() when its data changes.
    • Use the WebSocket connection ID as its persistent identity.

    The model will distinguish between:

    Event Type
    Opcode
    

    For example:

    Event:  Send
    Opcode: Text
    

    rather than combining these fields.


    4. CurrentNetworkRequests in network_controller.dart

    Responsibility

    Maintain the collection of Network entries displayed by DevTools.

    Changes

    Extend updateOrAddAll() so WebSocket connections can be inserted or updated.

    The update logic will follow the existing identity-based approach:

    connectionId
          ↓
    existing WebSocket NetworkRequest
          ↓
    update connection data
          ↓
    notifyListeners()
    

    If the connection is new:

    new connection
          ↓
    create WebSocket model
          ↓
    add to Network requests
    

    This ensures that polling does not create duplicate rows for the same WebSocket connection.


    5. network_request_inspector.dart

    Responsibility

    Determine which detail tabs are displayed for the selected Network request.

    Changes

    Add WebSocket-specific tabs to _generateTabs().

    Current generic structure:

    Overview
    

    HTTP adds:

    Headers
    Request
    Response
    Cookies
    

    WebSocket will add:

    Frames
    

    Result:

    WebSocket
        β”œβ”€β”€ Overview
        └── Frames
    

    The existing HTTP and Socket behavior will remain unchanged.


    6. network_request_inspector_views.dart

    Responsibility

    Render the detailed information for Network requests.

    Changes

    Extend NetworkRequestOverviewView with WebSocket-specific information.

    The WebSocket Overview will display:

    • URI
    • Connection ID
    • Connection state
    • Protocol
    • Bytes sent
    • Bytes received
    • Frames sent
    • Frames received
    • Ping count
    • Pong count
    • Last updated timestamp
    • Start time
    • End time
    • Duration

    The existing timing/overview logic will also be extended so WebSockets are not incorrectly treated as HTTP requests.


    7. New WebSocket Frames UI

    A dedicated WebSocket frames view will be added for the Frames tab.

    Responsibility

    Display WebSocket profiling events associated with the selected connection.

    The table will contain:

    Field Description
    Frame # Sequential event/frame number
    Direction Inbound / Outbound
    Event Connect, Open, Send, Receive, Ping, Pong, Close, Error
    Opcode WebSocket protocol opcode
    Payload Size Size associated with the event
    Timestamp Event timestamp
    Error Error information when applicable

    Selecting an event will expose expanded details:

    • Frame number
    • Connection ID
    • URI
    • Direction
    • Event type
    • Opcode
    • Payload size
    • Timestamp
    • Error type
    • Error message

    The frame view will update when the underlying WebSocket model receives new profiling events.


    Network Table Integration

    The existing NetworkRequestsTable already consumes:

    List<NetworkRequest>
    

    Therefore WebSocket entries will automatically participate in the existing Network table infrastructure.

    The WebSocket model will provide the values required by the existing columns:

    Method
    Address
    Status
    Type
    Duration
    Size
    Timestamp
    

    The Network table itself should require minimal or no WebSocket-specific changes.

    The timestamp will represent the WebSocket connection/start timestamp, while lastUpdated will remain a WebSocket Overview property.


    Incremental Updates

    The WebSocket profile API supports incremental retrieval using:

    updatedSince
    

    The intended flow is:

    Initial refresh
          β”‚
          β–Ό
    getWebSocketProfile()
          β”‚
          β–Ό
    connections + events
    

    Then:

    Next refresh
          β”‚
          β–Ό
    getWebSocketProfile(updatedSince: previousTimestamp)
          β”‚
          β–Ό
    new / updated WebSocket data
          β”‚
          β–Ό
    update existing NetworkRequest
    

    This allows the Network panel to display persistent WebSocket activity without repeatedly retrieving the complete profile.


    Selection and Live Updates

    A selected WebSocket connection should remain selected while its profile is updated.

    The connection ID will provide stable identity:

    WebSocket #42
         β”‚
         β”œβ”€β”€ Poll 1 β†’ create
         β”œβ”€β”€ Poll 2 β†’ update
         β”œβ”€β”€ Poll 3 β†’ update
         └── Poll 4 β†’ update
    

    The same WebSocket model will notify listeners when its statistics or events change.

    This allows:

    Overview
        ↓
    updated statistics
    
    Frames
        ↓
    new WebSocket events
    

    to update without requiring a new selection.


    Clear Profile

    The existing Network clear operation will also clear WebSocket profiling data through:

    clearWebSocketProfile(isolateId)
    

    After clearing:

    WebSocket profile
          ↓
    cleared
          ↓
    CurrentNetworkRequests
          ↓
    WebSocket entries removed
    

    Testing

    Tests will be added for the DevTools WebSocket integration.

    The testing scope will include:

    Model

    • WebSocket implements NetworkRequest.
    • Connection ID is stable.
    • URI and connection state are mapped correctly.
    • Statistics are mapped correctly.
    • Start/end timestamps are correct.
    • Duration is correct.
    • Connection updates modify the existing model.
    • New events are retained.
    • notifyListeners() is triggered when data changes.

    Network integration

    • WebSocket profile data is fetched.
    • Incremental updatedSince polling works.
    • New connections appear in the Network list.
    • Existing connections are updated rather than duplicated.
    • Clearing the profile removes WebSocket entries.
    • WebSocket selection remains stable across updates.

    UI

    • WebSocket appears in the Network table.
    • WebSocket Overview is displayed.
    • WebSocket Frames tab is displayed.
    • Frame/event data is rendered correctly.
    • Event and Opcode are displayed separately.
    • Error information is displayed when applicable.
    • Overview and Frames update when the WebSocket model changes.

    Expected Result

    After Milestone 4, a running Dart application using WebSockets will expose the connection through the existing Flutter DevTools Network screen.

    A WebSocket will appear as a normal Network entry and provide:

    Network Table
          β”‚
          β–Ό
    WebSocket Connection
          β”‚
          β”œβ”€β”€ Overview
          β”‚     β”œβ”€β”€ Connection information
          β”‚     β”œβ”€β”€ Statistics
          β”‚     └── Timing
          β”‚
          └── Frames
                β”œβ”€β”€ Connect
                β”œβ”€β”€ Open
                β”œβ”€β”€ Send
                β”œβ”€β”€ Receive
                β”œβ”€β”€ Ping
                β”œβ”€β”€ Pong
                β”œβ”€β”€ Close
                └── Error
    

    The implementation will reuse the existing Network Controller, NetworkRequest abstraction, polling mechanism, selection model, filtering, and inspector infrastructure while adding WebSocket-specific profiling and visualization where required.

  6. Victowolf commented on Aug 18, 2026

    @Victowolf
    OwnerAuthor

    ENTRY DATE: 16/08/2026 -19/08/2026

    • Worked on implementation
    • Extended Tests
    • Submitted a PR for review
  7. moved this from In progress to In review in Google Summer of Code 2026on Aug 19, 2026
  8. Victowolf commented on Aug 26, 2026

    @Victowolf
    OwnerAuthor

    ENTRY DATE: 20/08/2026 -22/08/2026

    • added offline support
    • address review feedbacks
  9. Victowolf commented on Aug 26, 2026

    @Victowolf
    OwnerAuthor

    ENTRY DATE: 23/08/2026 -24/08/2026

    • devtools vm_service dependecy bump to ^15.3.0
    • resolved merge conflicts and failing tests.
  10. Victowolf commented on Aug 26, 2026

    @Victowolf
    OwnerAuthor

    ENTRY DATE: 25/08/2026

    • final checks
    • successfully merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions