upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/27.md
diff options
context:
space:
mode:
authorRicardo Arturo Cabral Mejía <me@ricardocabral.io>2022-08-16 22:57:22 -0400
committerGitHub <noreply@github.com>2022-08-16 22:57:22 -0400
commitef059e0fdee06686d2a1f996aebeb092749fc976 (patch)
tree9f875681e9ccf895fcc1602ad37b00d67ca8b27e /27.md
parentf6346b6e2265013acdcbc6dacd4a00b69394da0c (diff)
NIP-27 Multicasting
Diffstat (limited to '27.md')
-rw-r--r--27.md67
1 files changed, 67 insertions, 0 deletions
diff --git a/27.md b/27.md
new file mode 100644
index 0000000..1b1a937
--- /dev/null
+++ b/27.md
@@ -0,0 +1,67 @@
1NIP-27
2======
3
4Multicasting
5------------
6
7`draft` `optional` `author:cameri`
8
9A new tag `m` meaning `multicast group` allow for events to be addressed to a
10group of clients simultaneously. Multicast in this scenario can be one-to-many
11or many-to-many.
12
13A relay MUST forward events containing `m` tags strictly to clients subscribed
14with a tag filter `#m` containing at least one of the values of such tags and
15refrain from forwarding such events to clients without such filter. The value
16of an `m` tag is case-sensitive.
17
18A client SHOULD send events containing `m` tags only to relays that explicitly
19support NIP-27. A NIP-16 supporting client MAY test for the capability by
20subscribing twice to a relay with and without the tag filter `#m` respectively
21and sending an ephemeral event with a random `m` tag of equal value.
22
23## Events
24
25Clients targeting a multicast group MAY include an `m` tag with a value set to
26an arbitrary string representing the multicast group.
27
28Suppose that Alice wants to multicast an event to a very special multicast group
29that covers specific topics. The multicast group is identified by the following
30string: `00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048`
31
32Alice would construct the following message and sends it to her favorite relay
33which happens to support multicasting:
34
35```json
36[
37 "EVENT",
38 {
39 "id": "<id>",
40 "pubkey": "<Alice's pubkey>",
41 "created_at": 1231469640,
42 "content": "Let's get the conversation started",
43 "tags": [
44 ["m", "00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048"],
45 ],
46 "sig": "<sig>"
47 }
48]
49```
50
51## Subscriptions
52
53Clients subscribing to a multicast group MUST include an `#m` tag filter with
54an array of multicast groups as values.
55
56Suppose that Bob and Charlie both share Alice's interest and would like to stay
57up to date. Both would construct the following message to subscribe:
58
59```
60[
61 "REQ",
62 "<subscriptionId>",
63 {
64 "#m": ["00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048"]
65 }
66]
67```