首页 > 解决方案 > ActivityStreams 在活动上的“to”字段与“audience”字段有何不同?

问题描述

ActivityStreams 规范在5.1 节to中解释了、ccbto和之间的区别。但是还有一个属性,定义为:bccaudience

一个或多个实体,它们代表可以认为对象相关的实体的总人口。

这与“to”和“cc”有什么不同?特别是,对ActivityPub 交付有什么不同的影响?

标签: json-ldactivity-streamsactivitypub

解决方案


答案可以在 ActivityPub 规范的问题列表中找到,在James M Snell的评论中:

audience用于定位。

例如,假设我有一个活动,我公司的每个人都应该在他们的活动提要中看到它,但只应该通知某些特定的人,我最终会得到如下结果:

{
  //...//
  "audience": {
    "type": "Organization",
    "id": "http://example.org",
    "name": "My Organization"
  },
  "to": ["http://jane.example.org", "http://joe.example.org"],
  "cc": ["http://sally.example.org"]
}

在这里,该audience属性提供了整个受众的范围,而tocc字段标识了该受众中应该更直接地通知活动的特定个人。

在讨论之后,规范被更新。请参阅受众群体定位,特别是在标准中。5.1.1对其使用有更多说明:

活动很少是孤立的事件。通常,多个单独的活动将围绕相似的背景或受众进行。例如,从事共享项目的合作者可能会在实现某个目标的过程中执行多项相关活动。此类活动可以使用该属性在逻辑上分组在一起context,并使用该属性将范围限定为特定受众audience

提供以下示例(示例 144):

{
 "@context": "https://www.w3.org/ns/activitystreams",
 "summary": "Activities in Project XYZ",
 "type": "Collection",
 "items": [
   {
     "summary": "Sally created a note",
     "type": "Create",
     "id": "http://activities.example.com/1",
     "actor": "http://sally.example.org",
     "object": {
      "summary": "A note",
       "type": "Note",
       "id": "http://notes.example.com/1",
       "content": "A note"
     },
     "context": {
       "type": "http://example.org/Project",
       "name": "Project XYZ"
     },
     "audience": {
       "type": "Group",
       "name": "Project XYZ Working Group"
     },
     "to": "http://john.example.org"
   },
   {
     "summary": "John liked Sally's note",
     "type": "Like",
     "id": "http://activities.example.com/1",
     "actor": "http://john.example.org",
     "object": "http://notes.example.com/1",
     "context": {
       "type": "http://example.org/Project",
       "name": "Project XYZ"
     },
     "audience": {
       "type": "Group",
       "name": "Project XYZ Working Group"
     },
     "to": "http://sally.example.org"
   }
 ]
}

推荐阅读