Skip to content

In-process clients

datadata’s client and server are connected by an event bus abstraction, not by a socket. One implementation routes events over WebSockets; another — the in-process event bus — dispatches them as plain function calls within a single JavaScript process.

connectInProcessClient wires a full client to a full server in the same process. It is not a mock: the same optimistic-update machinery, the same validation, the same event ordering — just with microtask latency instead of network latency.

The motivating use: an AI agent running next to the server (in the same Durable Object, in the current deployment) as a first-class client. A composite event bus lets in-process clients and WebSocket clients coexist on one server — so the agent stages edits through an in-process session while humans watch the same live documents from their browsers, each seeing the other’s changes in real time.

The server also exposes a change callback — a hook invoked on every accepted write — which is how agent-triggering, auditing, and downstream automation attach without polling.

The in-process bus is also why datadata is easy to exercise: the test suite runs real client/server pairs with no infrastructure, and the live demos planned for this site will run the same way — a complete sync engine, client and server, inside your browser tab.