Skip to content

Cherry-pick 75602014d: feat(browser): support direct WebSocket CDP URLs for Browserbase#1310

Merged
alexey-pelykh merged 2 commits intomainfrom
cherry-pick/75602014d-browser-ws-cdp-urls
Mar 14, 2026
Merged

Cherry-pick 75602014d: feat(browser): support direct WebSocket CDP URLs for Browserbase#1310
alexey-pelykh merged 2 commits intomainfrom
cherry-pick/75602014d-browser-ws-cdp-urls

Conversation

@alexey-pelykh
Copy link
Copy Markdown

Cherry-pick from upstream

Field Value
Upstream commit 75602014d
Author shrey150
Tier AUTO-PICK

Summary

Adds support for direct WebSocket CDP URLs (ws:// and wss://) for remote browser providers like Browserbase. Previously only HTTP(S) CDP endpoints were supported.

Conflict resolution: Import conflict in chrome.ts — fork removed cdp-timeouts constants and openCdpWebSocket; upstream added isWebSocketUrl. Resolved by adding isWebSocketUrl to fork's simplified imports and using fork's existing canOpenWebSocket implementation for the WebSocket reachability check.

Part of #908.

🤖 Generated with Claude Code

shrey150 and others added 2 commits March 14, 2026 14:10
Browserbase uses direct WebSocket connections (wss://) rather than the
standard HTTP-based /json/version CDP discovery flow used by Browserless.
This change teaches the browser tool to accept ws:// and wss:// URLs as
cdpUrl values: when a WebSocket URL is detected, OpenClaw connects
directly instead of attempting HTTP discovery.

Changes:
- config.ts: accept ws:// and wss:// in cdpUrl validation
- cdp.helpers.ts: add isWebSocketUrl() helper
- cdp.ts: skip /json/version when cdpUrl is already a WebSocket URL
- chrome.ts: probe WSS endpoints via WebSocket handshake instead of HTTP
- cdp.test.ts: add test for direct WebSocket target creation
- docs/tools/browser.md: update Browserbase section with correct URL
  format and notes

Co-Authored-By: Claude Opus 4.6 <[email protected]>
(cherry picked from commit 7560201)
Two pre-existing tests still expected ws:// URLs to be rejected by
parseHttpUrl, which now accepts them. Switch the invalid-protocol
fixture to ftp:// and tighten the assertion to match the full
"must be http(s) or ws(s)" error message.

(cherry picked from commit 8b2f40f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants