Skip to Content

Messages

Complete reference for all protocol messages.

Worker messages

TypeDescription
worker.helloInitial handshake from worker
worker.commandSend a browser command to the client
worker.yield_to_userHand control to the user with conditions
worker.completeMark session as successfully completed
worker.failMark session as failed with an error

Client messages

TypeDescription
client.helloInitial handshake from client
client.command_responseResult of executing a command
client.eventsBatch of telemetry events
client.console_activityConsole log entries from the webview
client.network_activityNetwork activity records from the webview
client.sdk_logInternal SDK log entries

Server messages (to client)

TypeDescription
server.helloHandshake response with session state
server.commandRelayed command for the client to execute
server.set_interactiveToggle webview visibility for the user
server.session_endSession has reached a terminal state
server.ackAcknowledge received client events
server.replayReplay buffered messages after reconnection

Server messages (to worker)

TypeDescription
server.helloHandshake response with session state
server.client_readyClient has connected to the session
server.client_disconnectedClient has disconnected
server.command_resultRelayed command result from the client
server.errorProtocol error
server.replayReplay buffered messages after reconnection

server.hello (to client)

The server.hello sent to the client includes optional configuration:

FieldTypeDescription
eventFilterEventFilterConfig?Which event types the server wants
debugboolean?Whether debug mode is enabled
captureCaptureConfig?Page snapshot/screenshot capture settings
injectionScriptsInjectionScript[]?JavaScript to inject at document start

Injection scripts

The server can deliver JavaScript injection scripts via server.hello. The client SDK injects these into the webview at document start. Built-in scripts include telemetry, network interception, console interception, and user interaction capture.

interface InjectionScript { name: string; // e.g. "telemetry", "network", "console", "interaction" source: string; // JavaScript source to inject }

Message format

All messages are JSON objects with a type field:

{ "type": "worker.command", "command": { "action": "navigate", "url": "https://example.com" } }

Next steps

Last updated on