I'm trying to fetch a single activity from getstream.io on the server following a realtime notification and enrich it.
As you can see below, it returns null until full page is fetched.
// Websockets fired. There is a new activity $id. Fetch and enrich:
// Get activity that begins with the new $id
$options = ['id_gte' => $id];
// PROBLEM: First call to get single item returns NULL
$feed->getActivities(0, 1, $options);
// Second call without conditions returns everything fine
$feed->getActivities(0, 15);
// The desired activity is now present in response
$feed->getActivities(0, 1, $options);
Is there a better way to handle this or a specific time delay before id based filters are available on new messages?
thanks for pointing this out. We can certainly improve our documentation to be more clear about how we handle this scenario.
When you use filters to fetch a feed, or non-zero offset
values, Stream does not return new items on the feed.
When you call $feed->getActivities(0, 15);
that's when we would send the value as part of the feed data to later also be available with filters.