Skip to content
This repository was archived by the owner on May 19, 2025. It is now read-only.
This repository was archived by the owner on May 19, 2025. It is now read-only.

Realtime: how to subscribe to multiple documents #597

@bnetter

Description

@bnetter

What's the equivalent of listening to multiple documents in a collection using the realtime-listener service?

I have a news-feed component where I'm trying to watch for new activities. Here's my activities computed property:

activities: computed('company', function() {
  return this.get('store').query('activity', {
    query: (ref) => ref.where(`company`, '==', this.get('company.id')).orderBy('createdAt', 'desc');
  });
})

That's fetching correctly current activities, but it's not updated live. How do I achieve that? I've tried the following:

this.get('realtime').subscribe(this, this.get('activities'));

It's obviously not working as the second parameter has to be a record, not an array.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions