From 867cfcff639f9262c5dc943d97ac6b27e1701f07 Mon Sep 17 00:00:00 2001 From: Riccardo Balbo Date: Tue, 30 Sep 2025 02:33:54 +0200 Subject: [PATCH] add d tag and rename "Standard Protocol" section to "Examples" --- DC.md | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/DC.md b/DC.md index 943e0582..1b062fc7 100644 --- a/DC.md +++ b/DC.md @@ -30,6 +30,10 @@ function decrypt(localPrivKey, content, senderPubkey, roomPublicKey){ } ``` +## Peer + +A peer is represented by the combination of a keypair (ideally a random one) and an optional `d` session id that can be used to discriminate between multiple connections from the same keypair, if the session id is not provided, the peer is identified only by the keypair. + ## Presence Event Periodically clients should broadcast this event to update their presence in the room and allow the other peers to discover them. @@ -41,6 +45,7 @@ Periodically clients should broadcast this event to update their presence in the "content": "", "tags": [ ["t", "connect"], + ["d", ""], ["P", ""], ["i", ""], ["y", ""], @@ -54,7 +59,7 @@ Periodically clients should broadcast this event to update their presence in the **`y` is an optional app id that is used to identify the application that should be used to handle this connection.** -**`i` is a protocol identifier that is used to identify the protocol that should be used to connect to this peer. See [Standard Protocols](#standard-protocols) for more details.** +**`i` is a protocol identifier that is used to identify the protocol that should be used to connect to this peer. See [Examples](#examples) for more details.** ## Disconnection Event @@ -66,6 +71,7 @@ When a peer leaves the room, it should broadcast this event to inform the other "content": "", "tags": [ ["t", "disconnect"], + ["d", ""], ["P", ""] ] } @@ -84,6 +90,7 @@ This list can be rebroadcasted as needed and each peer should maintain an update "content": "", "tags": [ ["t", "route"], + ["d", ""], ["p", ""], ["P", ""] ], @@ -103,6 +110,7 @@ Offer event is used to initiate a connection with another peer `p` in the room. "content": "", "tags": [ ["t", "offer"], + ["d", ""], ["p", ""], ["P", ""] ] @@ -117,12 +125,13 @@ Offer event is used to initiate a connection with another peer `p` in the room. The answer event is used to respond to an offer. -```json +```yaml { "kind": 25050, "content": "", "tags": [ ["t", "answer"], + ["d", ""], ["p", ""], ["P", ""] ], @@ -132,9 +141,9 @@ The answer event is used to respond to an offer. **The answer format is protocol specific.** -## Standard Protocols +## Examples -### Data Channels (webrtc-dc) +### Data Channels (`"i": "webrtc-dc"`) Binary packets via WebRTC Data Channels. @@ -145,6 +154,7 @@ Binary packets via WebRTC Data Channels. "content": "", "tags": [ ["t", "connect"], + ["d", ""], ["P", ""], ["i", "webrtc-dc"], ["y", ""], @@ -160,6 +170,7 @@ Binary packets via WebRTC Data Channels. "content": "", "tags": [ ["t", "disconnect"], + ["d", ""], ["P", ""] ] } @@ -186,6 +197,7 @@ Binary packets via WebRTC Data Channels. })), "tags": [ ["t", "route"], + ["d", ""], ["p", ""], ["P", ""] ], @@ -208,6 +220,7 @@ Binary packets via WebRTC Data Channels. })), "tags": [ ["t", "offer"], + ["d", ""], ["p", ""], ["P", ""] ] @@ -227,6 +240,7 @@ Binary packets via WebRTC Data Channels. })), "tags": [ ["t", "answer"], + ["d", ""], ["p", ""], ["P", ""] ]