-
Notifications
You must be signed in to change notification settings - Fork 962
Closed
Labels
Description
FCM API suggests that it offers rxjs compatibility out of box. Specifically, you could do
let foregroundMessages$ = rxjs.Observable.create(function subscribe(observer) {
messaging.onMessage(observer);
});
foregroundMessages$.subscribe({
next: (msg) => handleForegroundMessage(msg),
error: (err) => console.log("err: " + err),
});
However, an error is thrown:
Uncaught (in promise) TypeError: this._next is not a function
at rt.Subscriber.next [as onMessageCallback] (rxjs.umd.js:472)
at rt.<anonymous> (window-controller.ts:197)
at tslib.es6.js:100
at Object.next (tslib.es6.js:81)
at tslib.es6.js:74
at new Promise (<anonymous>)
at v (tslib.es6.js:70)
at rt.messageEventListener (window-controller.ts:188)
at ServiceWorkerContainer.<anonymous> (window-controller.ts:47)
Came across this error here as well (angular/angularfire#2299)