From 4ac66d97b3e65477071c52f48322dfe89a7981c2 Mon Sep 17 00:00:00 2001 From: John Livingston Date: Sun, 9 Jul 2023 06:51:11 +0000 Subject: [PATCH] FEP-1970: Chat Links (#122) This FEP describes a way to attach a chat room to [ActivityPub](https://www.w3.org/TR/activitypub/) actors and objects. The chat room itself can be a web page, a XMPP room, a Matrix room, an IRC channel, ... Co-authored-by: John Livingston Reviewed-on: https://codeberg.org/fediverse/fep/pulls/122 Co-authored-by: John Livingston Co-committed-by: John Livingston --- fep/1970/fep-1970.md | 214 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 214 insertions(+) create mode 100644 fep/1970/fep-1970.md diff --git a/fep/1970/fep-1970.md b/fep/1970/fep-1970.md new file mode 100644 index 0000000..ec43134 --- /dev/null +++ b/fep/1970/fep-1970.md @@ -0,0 +1,214 @@ +--- +slug: "1970" +authors: John Livingston +status: DRAFT +dateReceived: 2023-07-04 +--- +# FEP-1970: Chat Links + +## Summary + +This FEP describes a way to attach a chat room to [ActivityPub](https://www.w3.org/TR/activitypub/) actors and objects. +The chat room itself can be a web page, a XMPP room, a Matrix room, an IRC channel, ... The chat itself does not necessarily publish messages using ActivityPub. + +## Chat links + +Chat link is an object with the following properties: + +- `type` (REQUIRED): the type MUST be `Link`. +- `name` (RECOMMENDED): the `name` property SHOULD contain a human-readable description of the chat link. +- `href` (REQUIRED): the `href` property MUST contain a chat URI. This can be an URL of a website, or any other kind of [URI](https://datatracker.ietf.org/doc/rfc3986), such as a [XMPP uri](https://datatracker.ietf.org/doc/rfc5122/). +- `rel` (REQUIRED): the `rel` property MUST contain the string `discussion` or an array containing that string. The `discussion` relation type is proposed as a [HTML5 link type extensions](https://microformats.org/wiki/rel-discussion). + +Chat links MUST be added to the `attachment` array of an actor or an object. + +## Examples + +### Basic object attachment + +```json +{ + "@context": "https://www.w3.org/ns/activitystreams", + "type": "Article", + "id": "https://example.tld/video/123", + "attributedTo": "https://example.tld/users/alice", + "name": "Let's go live!", + "attachment": [ + { + "type": "Link", + "name": "Chat", + "href": "https://example.tld/chat/room/123", + "rel": "discussion" + } + ] +} +``` + +### Basic actor attachment + +```json +{ + "@context": "https://www.w3.org/ns/activitystreams", + "type": "Person", + "id": "https://example.tld/users/alice", + "inbox": "https://example.tld/users/alice/inbox", + "outbox": "https://example.tld/users/alice/outbox", + "attachment": [ + { + "type": "Link", + "name": "Chat", + "href": "https://example.tld/chat/room/123", + "rel": "discussion" + } + ] +} +``` + +### Multiple way to join the chat + +In the following example, the chat room can be joined using a web browser or a xmpp client: + +```json +{ + "@context": "https://www.w3.org/ns/activitystreams", + "type": "Video", + "id": "https://example.tld/video/123", + "attributedTo": "https://example.tld/users/alice", + "name": "Let's go live!", + "attachment": [ + { + "type": "Link", + "name": "Chat", + "href": "https://example.tld/chat/room/123", + "rel": "discussion" + }, + { + "type": "Link", + "name": "Chat", + "href": "xmpp://123@room.example.tld?join", + "rel": "discussion" + } + ] +} +``` + +### Live video stream + +For a live stream, represented by a [Video](https://www.w3.org/TR/activitystreams-vocabulary/#dfn-video) object, the chat link could link to the room where viewers can interract with the streamer. + +```json +{ + "@context": "https://www.w3.org/ns/activitystreams", + "type": "Video", + "id": "https://example.tld/video/123", + "attributedTo": "https://example.tld/users/alice", + "name": "Let's go live!", + "attachment": [ + { + "type": "Link", + "name": "Chat", + "href": "https://example.tld/chat/room/123", + "rel": "discussion" + } + ] +} +``` + +If the chat room is unique per streamer (and common to all the streamer videos), it can be attached to both the Video and the [Person](https://www.w3.org/TR/activitystreams-vocabulary/#dfn-person) object. + +```json +{ + "@context": "https://www.w3.org/ns/activitystreams", + "type": "Person", + "id": "https://example.tld/users/alice", + "following": "https://example.tld/users/alice/following", + "followers": "https://example.tld/users/alice/followers", + "name": "Alice", + "attachment": [ + { + "type": "Link", + "name": "Chat", + "href": "https://example.tld/chat/room/123", + "rel": "discussion" + } + ] +} + +{ + "@context": "https://www.w3.org/ns/activitystreams", + "type": "Video", + "id": "https://example.tld/video/123", + "attributedTo": "https://example.tld/users/alice", + "name": "Let's go live!", + "attachment": [ + { + "type": "Link", + "name": "Chat", + "href": "https://example.tld/chat/room/123", + "rel": "discussion" + } + ] +} +``` + +If the chat room is unique to a streamer's channel, it can be linked to both the Video and the [Group](https://www.w3.org/TR/activitystreams-vocabulary/#dfn-group) object. + +```json +{ + "@context": "https://www.w3.org/ns/activitystreams", + "type": "Group", + "id": "https://example.tld/channel/alice", + "following": "https://example.tld/users/alice/following", + "followers": "https://example.tld/users/alice/followers", + "name": "Alice channel", + "attachment": [ + { + "type": "Link", + "name": "Chat", + "href": "https://example.tld/chat/room/123", + "rel": "discussion" + } + ] +} + +{ + "@context": "https://www.w3.org/ns/activitystreams", + "type": "Video", + "id": "https://example.tld/video/123", + "attributedTo": "https://example.tld/users/alice", + "name": "Let's go live!", + "attachment": [ + { + "type": "Link", + "name": "Chat", + "href": "https://example.tld/chat/room/123", + "rel": "discussion" + } + ] +} +``` + +### Document discussion + +Some file sharing sofwares allows to have a discussion room attached to files. In such case, the chat links can be added as attachment to [Document](https://www.w3.org/TR/activitystreams-vocabulary/#dfn-document) objects. + +### Person instant messaging + +If a user has instant messaging applications, chat links could be added to its [Person](https://www.w3.org/TR/activitystreams-vocabulary/#dfn-person) object, so that we can join him. + +If the user has multiple instant messaging accounts (XMPP, Matrix, ...), each on of them can be added, and differenciated by the URI scheme. + +## Implementations + +At the time of the writing, this FEP is been implemented in the [Peertube livechat plugin](https://github.com/JohnXLivingston/peertube-plugin-livechat/), a chat plugin for [Peertube](https://joinpeertube.org/). + +## References + +- [ActivityPub] Christine Lemmer Webber, Jessica Tallon, [ActivityPub](https://www.w3.org/TR/activitypub/), 2018 +- [Microformats existing rel values] [Microformats existing rel values](https://microformats.org/wiki/existing-rel-values), referenced by the [HTML Living Standard](https://html.spec.whatwg.org/multipage/links.html#other-link-types). + +## Copyright + +CC0 1.0 Universal (CC0 1.0) Public Domain Dedication + +To the extent possible under law, the authors of this Fediverse Enhancement Proposal have waived all copyright and related or neighboring rights to this work.