Builds the core the application's Durable Object class delegates to.
The Durable Object's ctx
Optional seams; the defaults are the deployment path
Serves both halves of the inbox.
A WebSocket upgrade opens the caller's end; a POST delivers a reply from
a responder. Anything else is refused with the method or upgrade the caller
should have used.
The request the stub forwarded
A 101 carrying the client half, a 200 reporting how many sockets received the reply, a 405, or a 426
Handles the caller disconnecting.
Nothing is tracked, so nothing needs removing — the runtime drops the
socket from getWebSockets() itself. The handler exists so the
application's class can forward it without a branch.
The socket that closed
The close code the peer sent
The close reason the peer sent
Handles a socket error.
The socket that errored
Delivers RPC replies to the caller waiting on them.
This class holds no state, for the same reason
RealtimeBackplaneObjectCoreholds none: sockets are accepted withstate.acceptWebSocket, the hibernation API, so the runtime may evict the object and re-run this constructor before the reply arrives. A membershipSetin a field would empty itself on the first hibernation while every test that never hibernates kept passing.state.getWebSockets()survives hibernation and is the only membership consulted here.The reply body is forwarded verbatim and never parsed, so this object cannot corrupt an envelope and a future widening of the reply shape needs no redeploy of the class the application owns.
The application owns the class; this owns the behavior:
Example
Since
0.2.0