Interface: WebSocketSubscriptionOptions
このコンテンツはまだ日本語訳がありません。
Interface: WebSocketSubscriptionOptions
Section titled “Interface: WebSocketSubscriptionOptions”Defined in: client/src/sync/websocket.ts:21
Properties
Section titled “Properties”
readonlyurl:string
Defined in: client/src/sync/websocket.ts:26
The full wss://…/sync/coordinator URL. A ?room=… query parameter
is appended if room is supplied.
readonlyoptionalroom?:string
Defined in: client/src/sync/websocket.ts:28
Room to subscribe to. Defaults to “global”.
token?
Section titled “token?”
readonlyoptionaltoken?:string| (() =>string|Promise<string>)
Defined in: client/src/sync/websocket.ts:35
Shared secret required by the coordinator DO (matches its
PLASMA_COORDINATOR_TOKEN env var). Passed as ?token= because
browsers can’t attach custom headers to a WebSocket upgrade. Omit
only when the DO is deliberately public.
clientID?
Section titled “clientID?”
readonlyoptionalclientID?:string
Defined in: client/src/sync/websocket.ts:41
Presence identifier for this client. Also sent so the coordinator can broadcast which clientIDs are currently subscribed to the room. Omit to have the DO assign a random UUID.
userInfo?
Section titled “userInfo?”
readonlyoptionaluserInfo?:unknown
Defined in: client/src/sync/websocket.ts:43
Arbitrary JSON-serialisable presence payload (user name, colour, cursor…).
onPresence?
Section titled “onPresence?”
readonlyoptionalonPresence?: (entries) =>void
Defined in: client/src/sync/websocket.ts:45
Called when presence changes. Includes this client.
Parameters
Section titled “Parameters”entries
Section titled “entries”readonly PresenceEntry[]
Returns
Section titled “Returns”void
initialReconnectDelayMs?
Section titled “initialReconnectDelayMs?”
readonlyoptionalinitialReconnectDelayMs?:number
Defined in: client/src/sync/websocket.ts:50
Milliseconds to wait before reconnecting after a close. Grows on each consecutive failure to avoid a tight reconnect loop. Defaults to 500.
maxReconnectDelayMs?
Section titled “maxReconnectDelayMs?”
readonlyoptionalmaxReconnectDelayMs?:number
Defined in: client/src/sync/websocket.ts:51
WebSocketImpl?
Section titled “WebSocketImpl?”
readonlyoptionalWebSocketImpl?: (url,protocols?) =>WebSocket
Defined in: client/src/sync/websocket.ts:56
Constructor for the WebSocket implementation. Defaults to the global
WebSocket; used in tests to inject a fake transport.
Parameters
Section titled “Parameters”string | URL
protocols?
Section titled “protocols?”string | string[]
Returns
Section titled “Returns”WebSocket