feat: support remote CDP WebSocket URLs in --cdp flag#99
Merged
Conversation
Contributor
|
@rgarcia is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
db35812 to
9e9b357
Compare
4c34e9d to
38ec32e
Compare
Contributor
Author
|
rebased on latest main. This would be a killer feature and would love to see it merged in |
29d7324 to
3d26869
Compare
Collaborator
|
@rgarcia do you mind rebasing one more time? This will be the next to go in! |
Previously, the --cdp flag only accepted a port number and connected via
http://localhost:{port}. This made it impossible to connect to remote
browser services like Kernel, Browserless, etc. that provide WebSocket URLs.
The --cdp flag now accepts either:
- A port number (e.g., 9222) for local connections
- A full WebSocket URL (e.g., wss://...) for remote browser services
Changes:
- Added cdpUrl field to LaunchCommand type
- Updated protocol validation to accept URL format with scheme validation
- Modified connectViaCDP to detect and handle both formats
- Handle numeric strings for JSON serialization edge cases
- Updated CLI to send cdpUrl or cdpPort based on input format
- Updated README with examples for remote connections
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
3d26869 to
8c8aae7
Compare
Contributor
Author
Collaborator
|
Thank you!! |
3 tasks
timothywangdev
pushed a commit
to timothywangdev/banana-browser
that referenced
this pull request
Mar 17, 2026
Previously, the --cdp flag only accepted a port number and connected via
http://localhost:{port}. This made it impossible to connect to remote
browser services like Kernel, Browserless, etc. that provide WebSocket URLs.
The --cdp flag now accepts either:
- A port number (e.g., 9222) for local connections
- A full WebSocket URL (e.g., wss://...) for remote browser services
Changes:
- Added cdpUrl field to LaunchCommand type
- Updated protocol validation to accept URL format with scheme validation
- Modified connectViaCDP to detect and handle both formats
- Handle numeric strings for JSON serialization edge cases
- Updated CLI to send cdpUrl or cdpPort based on input format
- Updated README with examples for remote connections
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--cdpflag to accept either a port number OR a full WebSocket URLwss://endpointsMotivation
Previously,
--cdponly accepted a port number and connected viahttp://localhost:{port}. Remote browser services provide WebSocket URLs likewss://proxy.example.com/cdp?token=...that couldn't be used directly.Changes
src/types.ts: AddedcdpUrl?: stringfield toLaunchCommandsrc/protocol.ts: Added URL validation for the new fieldsrc/browser.ts: UpdatedconnectViaCDPto detect URL vs port and handle bothcli/src/main.rs: Updated CLI to sendcdpUrlfor URLs,cdpPortfor port numbersREADME.md: Updated documentation with remote connection examplesUsage
Test plan
pnpm test)wss://URL