使用 getstream 实时评论

Commenting in real time using getstream

我正在使用 getstream 的 js/node api,我正在尝试向活动评论添加实时功能,但我收到 403 错误,显示我没有权限。

我试过使用 targetFeeds: '[timeline:userid]' 但它破坏了应用程序。

我还尝试使用通知提要,因为正在使用文档,我可以像这样设置 targetFeeds:'[notification:userid]' 这显然不是我们想要做的事情,因为这会导致关于此用户不同活动的每条消息都将显示在回调中。

client.reactions.add("comment", activityId, {
      "text": newComment,
      "profileImage": 'https://i.pravatar.cc/300',
      "timestamp": date,
      "from": userId,
      "id": foreignId,
    },
    {targetFeeds: [`CommentsFeed:${activityId}`]});

403 的响应是下一个:

{
  code: 17
  detail: "You don't have permission to do this"
  duration: "0.18ms"
  exception: "NotAllowedException"
  status_code: 403
}

预期的结果是没有 403,这将触发我实现的回调。

默认权限设置只允许用户将活动写入他们自己的供稿;在这种情况下,您要将 activity 添加到 CommentsFeed:${activityId}.

您可以请求支持 (support@getstream.io) 为您的应用将此列入白名单。请务必提及此案例并附上您的申请。