From ef059e0fdee06686d2a1f996aebeb092749fc976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Arturo=20Cabral=20Mej=C3=ADa?= Date: Tue, 16 Aug 2022 22:57:22 -0400 Subject: [PATCH] NIP-27 Multicasting --- 27.md | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 27.md diff --git a/27.md b/27.md new file mode 100644 index 0000000..1b1a937 --- /dev/null +++ b/27.md @@ -0,0 +1,67 @@ +NIP-27 +====== + +Multicasting +------------ + +`draft` `optional` `author:cameri` + +A new tag `m` meaning `multicast group` allow for events to be addressed to a +group of clients simultaneously. Multicast in this scenario can be one-to-many +or many-to-many. + +A relay MUST forward events containing `m` tags strictly to clients subscribed +with a tag filter `#m` containing at least one of the values of such tags and +refrain from forwarding such events to clients without such filter. The value +of an `m` tag is case-sensitive. + +A client SHOULD send events containing `m` tags only to relays that explicitly +support NIP-27. A NIP-16 supporting client MAY test for the capability by +subscribing twice to a relay with and without the tag filter `#m` respectively +and sending an ephemeral event with a random `m` tag of equal value. + +## Events + +Clients targeting a multicast group MAY include an `m` tag with a value set to +an arbitrary string representing the multicast group. + +Suppose that Alice wants to multicast an event to a very special multicast group +that covers specific topics. The multicast group is identified by the following +string: `00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048` + +Alice would construct the following message and sends it to her favorite relay +which happens to support multicasting: + +```json +[ + "EVENT", + { + "id": "", + "pubkey": "", + "created_at": 1231469640, + "content": "Let's get the conversation started", + "tags": [ + ["m", "00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048"], + ], + "sig": "" + } +] +``` + +## Subscriptions + +Clients subscribing to a multicast group MUST include an `#m` tag filter with +an array of multicast groups as values. + +Suppose that Bob and Charlie both share Alice's interest and would like to stay +up to date. Both would construct the following message to subscribe: + +``` +[ + "REQ", + "", + { + "#m": ["00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048"] + } +] +```