WebSocket Configuration
Message Format
All messages follow the JSON-RPC 2.0 specification.Request
Success Response
Error Response
Notification (Server to Client)
Notifications have noid field and expect no response:
Authentication
BAP supports optional token-based authentication via two mechanisms:- Query Parameter
- Header
ws://localhost:9222?token=your-secret-tokenSecurity Features
Domain Allowlist
The server supports a domain allowlist that restricts which URLs can be navigated to:DomainNotAllowed error (code -32041).
Scope-Based Authorization
BAP defines four authorization scopes that control what actions a client can perform:Network Event Redaction
Server-pushed network events automatically redact sensitive headers:authorization,cookie,set-cookiex-api-key,x-auth-token,x-csrf-tokenproxy-authorization- All
postDatais blanket-redacted
URL Validation
All navigation methods (page/navigate, page/create, storage/setState) validate URLs before execution. javascript: protocol and cloud metadata endpoints are blocked.
Connection Management
Auto-Reconnect (Client SDK)
The TypeScript and Python SDKs implement exponential backoff reconnection:Request Timeout
All requests have a 30-second default timeout. Timed-out requests receive aTimeout error (code -32016) with retryable: true.