createChatNotifications
createChatNotifications(
options,destroyRef?):ChatNotifications
Defined in: angular/chat-notifications.ts:47
Builds an Angular-idiomatic wrapper over ChatNotificationsClient (see ../core) — a Signal for connectionState, an Observable per event type.
This is a plain factory, not an @Injectable() class: this package is
published as plain compiled JS (no ng-packagr/Angular-compiler pass), so
a decorated class here would have no ɵprov/ɵfac metadata and would
fail Angular’s Ivy-based dependency injection at runtime. signal() and
Observable have no such requirement — only Angular’s own DI decorators
do — so this factory is safe to call directly from wherever you want the
client to live, e.g. inside your own @Injectable({providedIn: 'root'})
service’s constructor:
@Injectable({ providedIn: 'root' })export class MyChatNotificationsService { private readonly notifications = createChatNotifications( { chatApiUrl, tenantId, applicationId, getAccessToken: () => this.auth.getAccessToken() }, inject(DestroyRef), ); readonly connectionState = this.notifications.connectionState; connect(): void { this.notifications.connect(); } messageCreated$ = this.notifications.on$('message.created');}Pass your own DestroyRef (inject(DestroyRef)) to auto-disconnect
when that injection context is destroyed, or omit it and call
disconnect() yourself (e.g. from ngOnDestroy).
Parameters
Section titled “Parameters”options
Section titled “options”ChatNotificationsClientOptions
destroyRef?
Section titled “destroyRef?”DestroyRef