GetStream/stream-meteor

Accessing Follower / Following stats through Meteor package

Closed this issue · 5 comments

Hi - I'm currently integrating the Stream Meteor package into an app.
I have been able to use the package API to make one user follow another user, though there are some features that would be helpful to add at some point:

  • Allowing a user to follow a flat feed that is not another user (currently users can only follow other users)
  • Determining whether one user is already following another, something like an isFollowing(user1, feed2)
  • A simple count of number followers and number following for a user or flat feed

I've been able to accomplish the above items by using the low level API, but I think they will be fairly common use cases so would be good to include them in the Meteor package API.

Hi, thank you for all the feedback.

  • Allowing a user to follow a flat feed that is not another user (currently users can only follow other users)

Achieve this behavior by accessing the low-level api client on the server through: Stream.stream.

  • Determining whether one user is already following another, something like an isFollowing(user1, feed2)

This could be a nice feature for the library, for now you can use the low-level js client to call feed.following({ limit: 1, offset: 0, filter: ['feed:2'] }) and check whether this returns a result (be careful this method is an asynchronous call to the api and returns a Promise).

  • A simple count of number followers and number following for a user or flat feed

Unsupported by the API, to achieve this store the follow relationships in your local database.

Thanks Matthisk - for 1 and 2, your suggested strategy with the low level api is what I am currently using. For the last one I'm currently using the low level api to pull a list of followers and then counting the number of followers that are users (for following I'm just taking the length of the array). Not particularly efficient, but works for now. Mostly just throwing out these things as features that you may want to consider building into the Meteor API down the line.

Performing a count that way works when you have feeds following tens or hundreds of other feeds, but what happens when a feed follows ten of thousands or hundred of thousands of feeds then this operation will be very costly, this is the reason we do not support a count on the relationships currently.

Oh it's definitely not efficient, but the only other way I can see to do it
would be to keep track of of follower/following relationships in my own
local database. Then I have to worry about syncing with your database
(databases always seem to fall out of sync for some reason or another). One
of the things I like about hosted service providers is that I don't need to
sync/maintain local copy of data (unless as a backup or I want to).

I'll probably end up moving to a local relationship database, but just
pointing out some features that might be helpful to eventually add to the
API.

On Tue, Mar 1, 2016 at 8:01 AM, Matthisk Heimensen <notifications@github.com
javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:

Performing a count that way works when you have feeds following tens or
hundreds of other feeds, but what happens when a feed follows ten of
thousands or hundred of thousands of feeds then this operation will be very
costly, this is the reason we do not support a count on the relationships
currently.


Reply to this email directly or view it on GitHub
#2 (comment)
.

Karl Antle
703-969-4802

Karl Antle
703-969-4802

Thank you for the feedback Karl. I've added the follower/following counts to our roadmap. Let us know if you have any other feedback or questions.