The Durable Object namespace binding
Identity, topic, and the logger thunk
ReadonlyoriginThis instance's identity, stamped onto every frame it publishes.
Stable for the lifetime of the instance and distinct from every peer's.
Closes the socket and drops every handler.
Publishes a frame to every other subscribed replica.
The frame to publish
Registers a handler for frames arriving from other replicas.
Invoked per arriving frame
A function that removes this handler
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.
Example
Since
0.2.0