3

Can we get stream without user id i.e. without $results = $user_feed_1->getActivities(5, 10);

I want to get all streams for all users. Is it possible ?

Tommaso Barbugli
  • 11,781
  • 2
  • 42
  • 41
Ankesh Kumar
  • 515
  • 2
  • 17

1 Answers1

3

It is currently not possible to retrieve activities stored on many feeds in a single request. You can only read activities from one feed at the time.

You can achieve that by sending all activities to a global feed. The suggested way to do this, is to use the to targeting field as documented here: http://getstream.io/docs/#targetting

For example:

$userOneFeed = $client->feed('user', '1');
$data = [
    "actor"=>"user:tommaso",
    "verb"=>"reply",
    "object"=>"question:35312059",
    "to"=>["flat:global"]
];
$userFeedOne->addActivity($data);

this code adds an activity to $userOneFeed and to the global feed. If you add the to field every time you add an activity, you will be able to fetch all activities by reading from the global feed.

$globalFeed = $client->feed('flat', 'global');
$globalFeed->getActivities(5, 10);
Tommaso Barbugli
  • 11,781
  • 2
  • 42
  • 41
  • With laravel we get feed like : $feed = \FeedManager::getNewsFeeds($user_id)['flat']; How to implement getfeed as above – Ankesh Kumar Feb 11 '16 at 08:05