【发布时间】:2019-04-25 17:32:14
【问题描述】:
我正在尝试设置一个演示,用户可以在其中收到有关其工作区中正在发生的事情的通知。
我用notification 类型的通知 提要和flat 类型的工作区 提要来塑造这个模型。
在 getstream 世界中,用户和工作区都通过它们的 ID 来标识
用户的通知提要跟随他的工作区的工作区提要。 服务器端:
const client = stream.connect(apiKey, secret, appId)
const feed = client.feed('notification', userId).follow('workspace', workspaceId, (r, e) => console.log("result: ", r, "error: ", e))
然后在应用程序中,我想订阅 通知 提要以实时获取新通知,并检索最后 5 个通知以在下拉列表中显示它们(facebook 样式):
const streamClient = stream.connect(apiKey, token, appId)
notificationFeed = streamClient.feed('notification', userId)
subscription = notificationFeed.subscribe(handleNewEvents)
notificationFeed.get.get({mark_seen: true, limit: 5})
最后一次获取请求出现 403 错误:
{"detail":"You don't have permission to do this","status_code":403,"code":17,"exception":"NotAllowedException","duration":"0.10ms"}
可能是什么原因?
【问题讨论】:
标签: permissions feed getstream-io