TanStack Logo

No fetches yet
Disconnected

capnweb + Workers

WebSocket RPC from browser to worker to Durable Objects

A reference app showing how capnweb can route all communication over a single WebSocket — including TanStack Start server functions, direct RPC methods, and multiplexed Durable Object connections with hibernation support.

Architecture

Browser
React app
capnweb RPC session
wsFetch for server functions
Cloudflare Worker
CoreRpcRoot .fetch() .connectCounter() ...
TanStack Start handler
DO root stubs #doRoots
Durable Objects
SharedCounterDO
SharedReactionBoardDO
hibernation + capnweb RPC
Server functions

TanStack Start createServerFn calls are serialized as Request objects and sent over the WebSocket via CoreRpcRoot.fetch().

Direct RPC

Methods like rollDice() and banner() run directly on the worker. No HTTP round-trip, no TanStack Start overhead.

DO multiplexing

Worker opens capnweb sessions to DOs over hibernating WebSockets. Child capability stubs are proxied to the browser automatically.