如何在getstream-io中创建公共活动

时间:2016-09-16 16:01:39

标签: getstream-io

我想广播一些活动,例如“用户加入”,供所有成员查看。目前我有一个平坦的user Feed。有没有办法推动活动,以便每个人都能看到它?

1 个答案:

答案 0 :(得分:2)

您可以使用“收件人”字段将活动添加到全局Feed。例如:

// Instantiate a feed using feed class 'user' and user id '1'
var user1 = client.feed('user', '1');
// Add an activity to the feed
var activity = {"to": ["user:global"], "actor": "User:1", "verb": "pin", "object": "Place:42", "target": "Board:1"};
user1.addActivity(activity)
// activity is added to both user:1 as well as user:global

或者,您可以拥有1个编辑帐户,然后是所有用户。