diff options
Diffstat (limited to '53.md')
| -rw-r--r-- | 53.md | 125 |
1 files changed, 125 insertions, 0 deletions
| @@ -0,0 +1,125 @@ | |||
| 1 | NIP-53 | ||
| 2 | ====== | ||
| 3 | |||
| 4 | Live Activities | ||
| 5 | --------------- | ||
| 6 | |||
| 7 | `draft` `optional` `author:vitorpamplona` `author:v0l` | ||
| 8 | |||
| 9 | ## Abstract | ||
| 10 | |||
| 11 | Service providers want to offer live activities to the Nostr network in such a way that participants can easily logged and queried by clients. This NIP describes a general framework to advertise the involvement of pubkeys in such live activities. | ||
| 12 | |||
| 13 | # Live Event | ||
| 14 | |||
| 15 | A special event with `kind:30311` "Live Event" is defined as a [NIP-33: Parameterized Replaceable Events](33.md) of public `p` tags. Each `p` tag SHOULD have a **displayable** marker name for the current role (e.g. `Host`, `Speaker`, `Participant`) of the user in the event and the relay information MAY be empty. This event will be constantly updated as participants join and leave the activity. | ||
| 16 | |||
| 17 | For example: | ||
| 18 | |||
| 19 | ```js | ||
| 20 | { | ||
| 21 | "kind": 30311, | ||
| 22 | "tags": [ | ||
| 23 | ["d", "<unique identifier>"], | ||
| 24 | ["title", "<name of the event>"], | ||
| 25 | ["summary", "<description>"], | ||
| 26 | ["image", "<preview image url>"], | ||
| 27 | ["t", "hashtag"] | ||
| 28 | ["streaming", "<url>"], | ||
| 29 | ["recording", "<url>"], // used to place the edited video once the activity is over | ||
| 30 | ["starts", "<unix timestamp in seconds>"], | ||
| 31 | ["ends", "<unix timestamp in seconds>"], | ||
| 32 | ["status", "<planned, live, ended>"], | ||
| 33 | ["current_participants", "<number>"], | ||
| 34 | ["total_participants", "<number>"], | ||
| 35 | ["p", "91cf9..4e5ca", "wss://provider1.com/", "Host", "<proof>"], | ||
| 36 | ["p", "14aeb..8dad4", "wss://provider2.com/nostr", "Speaker"], | ||
| 37 | ["p", "612ae..e610f", "ws://provider3.com/ws", "Participant"], | ||
| 38 | ["relays", "wss://one.com", "wss://two.com", ...] | ||
| 39 | ], | ||
| 40 | "content": "", | ||
| 41 | ...other fields | ||
| 42 | } | ||
| 43 | ``` | ||
| 44 | |||
| 45 | A distinct `d` tag should be used for each activity. All other tags are optional. | ||
| 46 | |||
| 47 | Providers SHOULD keep the participant list small (e.g. under 1000 users) and, when limits are reached, Providers SHOULD select which participants get named in the event. Clients should not expect a comprehensive list. Once the activity ends, the event can be deleted or updated to summarize the activity and provide async content (e.g. recording of the event). | ||
| 48 | |||
| 49 | Clients are expected to subscribe to `kind:30311` events in general or for given follow lists and statuses. Clients MAY display participants' roles in activities as well as access points to join the activity. | ||
| 50 | |||
| 51 | Live Activity management clients are expected to constantly update `kind:30311` during the event. Clients MAY choose to consider `status=live` events after 1hr without any update as `ended`. The `starts` and `ends` timestamp SHOULD be updated when the status changes to and from `live` | ||
| 52 | |||
| 53 | The activity MUST be linked to using the NIP-19 naddr code along with the "a" tag (see [NIP-33](33.md) and [NIP-19](19.md)). | ||
| 54 | |||
| 55 | ## Proof of Agreement to Participate | ||
| 56 | |||
| 57 | Event owners can add proof as the 5th term in each `p` tag to clarify the participant's agreement in joining the event. The proof is a signed SHA256 of the complete `a` Tag of the event (`kind:pubkey:dTag`) by each `p`'s private key, encoded in hex. | ||
| 58 | |||
| 59 | Clients MAY only display participants if the proof is available or MAY display participants as "invited" if the proof is not available. | ||
| 60 | |||
| 61 | This feature is important to avoid malicious event owners adding large account holders to the event, without their knowledge, to lure their followers into the malicious owner's trap. | ||
| 62 | |||
| 63 | # Live Chat Message | ||
| 64 | |||
| 65 | Event `kind:1311` is live chat's channel message. Clients MUST include the `a` tag of the activity with a `root` marker. Other Kind-1 tags such as `reply` and `mention` can also be used. | ||
| 66 | |||
| 67 | ```js | ||
| 68 | { | ||
| 69 | "id": "<32-bytes lowercase hex-encoded SHA-256 of the the serialized event data>", | ||
| 70 | "pubkey": "<32-bytes lowercase hex-encoded public key of the event creator>", | ||
| 71 | "created_at": "<Unix timestamp in seconds>", | ||
| 72 | "kind": 1311, | ||
| 73 | "tags": [ | ||
| 74 | ["a", "34550:<Community event author pubkey>:<d-identifier of the community>", "<Optional relay url>", "root"], | ||
| 75 | ], | ||
| 76 | "content": "Zaps to live streams is beautiful." | ||
| 77 | } | ||
| 78 | ``` | ||
| 79 | |||
| 80 | # Use Cases | ||
| 81 | |||
| 82 | Common use cases include meeting rooms/workshops, watch-together activities, or event spaces, such as [live.snort.social](https://live.snort.social) and [nostrnests.com](https://nostrnests.com). | ||
| 83 | |||
| 84 | # Example | ||
| 85 | |||
| 86 | Live Streaming | ||
| 87 | |||
| 88 | ```json | ||
| 89 | { | ||
| 90 | "id": "57f28dbc264990e2c61e80a883862f7c114019804208b14da0bff81371e484d2", | ||
| 91 | "pubkey": "1597246ac22f7d1375041054f2a4986bd971d8d196d7997e48973263ac9879ec", | ||
| 92 | "created_at": 1687182672, | ||
| 93 | "kind": 30311, | ||
| 94 | "tags": [ | ||
| 95 | ["d", "demo-cf-stream"], | ||
| 96 | ["title", "Adult Swim Metalocalypse"], | ||
| 97 | ["summary", "Live stream from IPTV-ORG collection"], | ||
| 98 | ["streaming", "https://adultswim-vodlive.cdn.turner.com/live/metalocalypse/stream.m3u8"], | ||
| 99 | ["starts", "1687182672"] | ||
| 100 | ["status", "live"], | ||
| 101 | ["t", "animation"], | ||
| 102 | ["t", "iptv"], | ||
| 103 | ["image", "https://i.imgur.com/CaKq6Mt.png"] | ||
| 104 | ], | ||
| 105 | "content": "", | ||
| 106 | "sig": "5bc7a60f5688effa5287244a24768cbe0dcd854436090abc3bef172f7f5db1410af4277508dbafc4f70a754a891c90ce3b966a7bc47e7c1eb71ff57640f3d389" | ||
| 107 | } | ||
| 108 | ``` | ||
| 109 | |||
| 110 | Live Streaming chat message | ||
| 111 | |||
| 112 | ```json | ||
| 113 | { | ||
| 114 | "id": "97aa81798ee6c5637f7b21a411f89e10244e195aa91cb341bf49f718e36c8188", | ||
| 115 | "pubkey": "3f770d65d3a764a9c5cb503ae123e62ec7598ad035d836e2a810f3877a745b24", | ||
| 116 | "created_at": 1687286726, | ||
| 117 | "kind": 1311, | ||
| 118 | "tags": [ | ||
| 119 | ["a", "30311:1597246ac22f7d1375041054f2a4986bd971d8d196d7997e48973263ac9879ec:demo-cf-stream", "", "root"] | ||
| 120 | ], | ||
| 121 | "content": "Zaps to live streams is beautiful.", | ||
| 122 | "sig": "997f62ddfc0827c121043074d50cfce7a528e978c575722748629a4137c45b75bdbc84170bedc723ef0a5a4c3daebf1fef2e93f5e2ddb98e5d685d022c30b622" | ||
| 123 | } | ||
| 124 | ```` | ||
| 125 | |||