domWebSocketDriver()
Adapt a DOM/WebSocket constructor into a graph-local WebSocket driver.
Import
Section titled “Import”import { domWebSocketDriver } from "@graphrefly/ts/graph";Signature
Section titled “Signature”function domWebSocketDriver(WebSocketCtor: WebSocketConstructorLike = requireGlobalWebSocket()): LocalWebSocketDriverParameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
WebSocketCtor | WebSocketConstructorLike | WebSocket constructor used to open connections. |
Returns
Section titled “Returns”A driver that can connect, send, and optionally stream live sessions.
Example
Section titled “Example”import { domWebSocketDriver } from "@graphrefly/ts/graph";
const ws = domWebSocketDriver(WebSocket);Source
Section titled “Source”packages/ts/src/graph/environment.ts