Event-Set Gossip with Probabilistic Awareness
Scale horizontally with a socketless, distributed event system.
- No WebSockets: Uses standard HTTP/2 POST requests.
- Probabilistic Awareness: Nodes exchange Bloom Filter summaries instead of full data.
- Gossip Protocol: Converges state efficiently across 100k+ concurrent clients.
- Backend Optional: Works with standalone servers OR embedded in Next.js/Vite.
Reality treats "Truth" not as a single state object, but as a set of events. Each node (Client or Server) maintains:
- An Append-Only Log of events.
- A Bloom Filter representing "I have seen events {A, B, C}".
Applications sync by exchanging filters:
- Client sends filter
F_client. - Server calculates
Diff(F_client, Store_server). - Server returns missing events.
- Client adds events + updates local filter.
- (Bidirectional) Client sends missing events to Server.
npm install @rootlodge/realityimport { useReality, useRealityClient } from "@rootlodge/reality/react";
function App() {
useRealityClient({
peers: ["https://reality.example.com"],
namespace: "my-app",
});
const { events, publish } = useReality("chat-room");
return <button onClick={() => publish({ msg: "Hello" })}>Send</button>;
}import { createRealityServer } from "@rootlodge/reality/server";
const server = createRealityServer({
port: 8080,
storage: "memory",
});
server.start();// app/api/reality/route.ts
import { createEmbeddedRealityServer } from "@rootlodge/reality/server";
const server = createEmbeddedRealityServer({
hmrSafe: true,
});
export const POST = server.handleRequest;