Bernardo Wilberger
Bernardo Wilberger

Reputation: 85

getstream notification subscription doesn't push aggreagated info with counts

I am using getstream nodejs package.

I've got an aggregated notifications feed and it properly fetches aggregated activities with feed.get()

The problem is that when subscribing via feed.subscribe() I only get the activity, not the agreaggated info with the seen & unseen counts as described here https://kuus.github.io/getstream/docs/index.html#realtime

Is there some parameter I'm missing?

Upvotes: 2

Views: 233

Answers (1)

Bernardo Wilberger
Bernardo Wilberger

Reputation: 85

So, I tried different versions of the Stream js client (I'm using 4.3.0v because it's latest compatible with Node v8.0) up to the latest 4.7.0 and the behaviour persists. It looks like Notifications feeds don't really push aggregated data to the client, just activities like a flat feed. Anyhow, this is the workaround I found around that.

feed.subscribe(async ({ new: activities }) => {
  const {
    results: notifications,
    unread,
    unseen,
  } = await feed.getActivityDetail([activities.map(({ id }) => id)]);

 /* ...do something with notifications, unseen and unread */
});

Upvotes: 1

Related Questions