Carries RealtimeFrames between replicas over one WebSocket to a
Durable Object.
The guarantee is narrower than "a durable cross-replica subscription", and deliberately so. A Cloudflare Worker isolate is evicted at the platform's discretion and its outbound WebSockets go with it, so no Worker can hold a subscription indefinitely. What makes that sound rather than lossy is the coupling: the members this subscription serves are client WebSockets held by the same isolate, and an HTTP-triggered Worker stays alive as long as its clients remain connected. Losing the isolate loses the subscription and the members it was fanning out to together, which is consistent. The socket is therefore opened lazily on the first publish and reopened after any failure, rather than held open by a keepalive that would only fight the platform's eviction.
DurableObjectBackplane(namespace: IDurableObjectNamespace,options: DurableObjectBackplaneOptions)
namespace: IDurableObjectNamespace
The Durable Object namespace binding
options: DurableObjectBackplaneOptions
Identity, topic, and the logger thunk
origin: string
This instance's identity, stamped onto every frame it publishes.
Stable for the lifetime of the instance and distinct from every peer's.
close(): Promise<void>
Closes the socket and drops every handler.
connect(): Promise<void>
Opens the socket to the Durable Object. Idempotent and concurrency-safe.
publish(frame: RealtimeFrame): Promise<void>
Publishes a frame to every other subscribed replica.
subscribe(handler: RealtimeFrameHandler): Promise<() => void>
Registers a handler for frames arriving from other replicas.