For AI agents: a documentation index is available at /llms.txt
Skip to main content

TransportFactory

type TransportFactory = (url?) =>
| ConnectionTransport
| Promise<ConnectionTransport>;

Builds a ConnectionTransport for a given endpoint URL. Supply one via ConnectOptions.transport to override the default WebSocket transport. The returned promise must resolve only once the connection is open — the library begins sending frames as soon as it resolves. This is a factory rather than a single instance because Browser.newPage invokes it per page and Transport assigns onmessage/onclose/onerror on the returned transport each time — so every page must get a fresh transport instance. Reusing one instance across pages would overwrite the earlier pages' handlers and cross-wire their frames, unless the transport itself multiplexes.

Parameters

ParameterType
url?string

Returns

| ConnectionTransport | Promise<ConnectionTransport>