Add broadcaster subscription lifecycles

This commit is contained in:
2026-07-27 09:31:46 +00:00
parent e4ceacade8
commit 35d38d4465
5 changed files with 597 additions and 1 deletions
+5 -1
View File
@@ -1,5 +1,6 @@
import { Config } from './services/config.ts';
import { Database, MigrationService } from './services/storage/index.ts';
import { Broadcaster } from './services/broadcaster.ts';
import { ApplicationRouter } from './services/router.ts';
import { Logger } from './utils/logger.ts';
@@ -18,6 +19,8 @@ export class App {
const migrations = new MigrationService(database, debug);
await migrations.migrateToLatest();
// Domain services are shared across all transports and route modules.
const broadcaster = new Broadcaster(debug);
const routes = [];
// Route loading is an explicit startup phase, not first-request work.
@@ -25,13 +28,14 @@ export class App {
// before any client can connect.
const router = await ApplicationRouter.create(routes);
return new App(database, router);
return new App(database, broadcaster, router);
}
private stopPromise: Promise<void> | undefined;
constructor(
private readonly database: Database,
private readonly broadcaster: Broadcaster,
private readonly router: ApplicationRouter,
) {}