Search code examples
getstream-io

Getstream.io how to include notification count in realtime subscription


When subscribing to a notification feed, is there any way to get the unseen and unread notification counts from the payload given by the getstream realtime subscription promise? If not, are there plans to implement this in the future?

I'm aware I can do a notificationFeed.get({limit: 0}) to retrieve that data, however, within our current system, it would be a lot more convenient if that count came with the subscription payload.

this.notificationFeed
    .subscribe((payload) => {
      console.log(payload)
    })
    .then(() => {
      //console.log('Full (Global Feed Flat): Connected to faye channel, waiting for realtime updates');
    }, (err) => {
      console.error('Full (Notification Feed): Could not establish faye connection', err);
    });

Currently, the payload doesn't include the unseen or unread counts when giving back data from a notification feed.


Solution

  • The realtime notification payload does not include unseen / unread counts for a feed. If you listen for changes on a feed and want to update counters you need to perform an API call and retrieve the counters from there.