Add broadcaster subscription lifecycles
This commit is contained in:
+5
-1
@@ -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,
|
||||
) {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user