first commit

This commit is contained in:
2026-07-12 15:55:18 +05:30
commit ee98026cc5
404 changed files with 44522 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
/**
* Build the cross-process realtime bus from config. When realtime scaling is
* enabled, room broadcasts are bridged over Redis pub/sub so they reach clients
* on every app process/instance (multiple runs, or multiple apps behind the
* gateway). Returns undefined when scaling is off (single-process realtime).
*/
import type { RealtimeBus } from "@wrnexus/core";
import { createPubSub } from "@wrnexus/pubsub";
import { redisDriver } from "@wrnexus/pubsub/redis";
export function realtimeBusFromConfig(cfg?: {
scale?: boolean;
redisUrl?: string;
}): RealtimeBus | undefined {
if (!cfg?.scale && !cfg?.redisUrl) return undefined;
return createPubSub(redisDriver(cfg.redisUrl));
}