Skip to content

Conversation

@daohoangson
Copy link
Contributor

Summary

Add support for connecting to Chrome via WebSocket endpoint with custom headers, enabling authenticated remote debugging scenarios and providing an alternative to the HTTP-based connection method.

What's New

This PR introduces two new CLI arguments:

  • --browserWsEndpoint / -w: Connect directly to Chrome using a WebSocket URL

    • Example: ws://127.0.0.1:9222/devtools/browser/<id>
    • Alternative to --browserUrl (mutually exclusive)
  • --wsHeaders: Pass custom headers for WebSocket connections (JSON format)

    • Example: '{"Authorization":"Bearer token"}'
    • Only works with --browserWsEndpoint

Use Cases

  • Authenticated remote debugging: Use API keys, tokens, or custom auth headers
  • Direct connections: Bypass HTTP endpoint resolution for faster connections
  • Secured instances: Connect to browser instances requiring authentication

daohoangson and others added 2 commits October 16, 2025 17:51
Add support for connecting to Chrome via WebSocket endpoint with custom headers:
- Add --browserWsEndpoint/-w argument for direct WebSocket connections
- Add --wsHeaders argument for custom WebSocket headers (e.g., auth tokens)
- Update ensureBrowserConnected to support both browserURL and browserWSEndpoint
- Add validation for WebSocket protocol (ws:// or wss://)
- Add JSON validation for custom headers
- Update documentation with usage examples

This enables authenticated remote debugging scenarios and provides
an alternative to the HTTP-based --browserUrl connection method.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@google-cla
Copy link

google-cla bot commented Oct 16, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@daohoangson daohoangson marked this pull request as draft October 16, 2025 11:16
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.

1 participant