【问题标题】:Fetching single activity from getstream.io从 getstream.io 获取单个活动
【发布时间】:2017-05-27 03:31:41
【问题描述】:

我正在尝试根据实时通知从服务器上的 getstream.io 获取单个活动并丰富它。

正如您在下面看到的,它返回 null 直到获取整页。

// 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); 

在基于 id 的过滤器可用于新消息之前,是否有更好的方法来处理此问题或特定时间延迟?

【问题讨论】:

    标签: php getstream-io


    【解决方案1】:

    感谢您指出这一点。我们当然可以改进我们的文档,以便更清楚地了解我们如何处理这种情况。

    当您使用过滤器获取提要或非零 offset 值时,Stream 不会返回提要上的新项目。

    当您致电 $feed->getActivities(0, 15); 时,我们会将值作为提要数据的一部分发送,以便稍后也可以使用过滤器。

    【讨论】:

    • 感谢您指出这一点。是否有其他方法来获取该消息或获取所有消息的唯一方法?
    • 由于这是您通过 Stream 发送给我们的活动,因此除了 Stream activity_id(在调用“添加活动”API 端点时返回)之外,您已经拥有从我们那里返回的所有内容)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-02-16
    • 1970-01-01
    • 1970-01-01
    • 2020-10-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多