Skip to content

CDP client needs response ID correlation (multiplexed command/response) #34

@justrach

Description

@justrach

Problem

The current CdpClient.send() sends a command and reads the next WebSocket message as the response. But CDP can send events (no id field) between command responses. If Chrome pushes an event before our response, we'll return the wrong data.

Fix

Implement response correlation:

  1. Parse the id field from each received message
  2. If it matches our sent command ID → return as response
  3. If it's an event (no id) → buffer/skip and read next message
  4. Add timeout for response waiting

Inspiration

vercel-labs/agent-browser handles this via Playwright's built-in CDP session management which correlates responses internally.

Files

  • src/cdp/client.zig (send method)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority:p1High prioritystatus:doneWork item is complete

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions