Skip to content

FCM rxjs compatibility broken?  #3142

@zwu52

Description

@zwu52

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)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions