From aadc197e88a19a1422addbe60321740594937d28 Mon Sep 17 00:00:00 2001 From: Jack Chakany Date: Mon, 13 Mar 2023 19:58:18 -0400 Subject: [PATCH] Initial Draft --- 100.md | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 100.md diff --git a/100.md b/100.md new file mode 100644 index 00000000..07426645 --- /dev/null +++ b/100.md @@ -0,0 +1,80 @@ +# NIP-100 +## WebRTC +`draft` `optional` `author:jacany` + +This NIP defines how to do WebRTC communication over nostr + +### Broadcasting that you are present +Announces that you are here, and ready to connect to others. +The connection ID is inferred from the provided pubkey. +```json +{ + "kind": 25050, + "pubkey": "", + "tags": [ + ["type", "connect"] + ] +} +``` + +### Closing +```json +{ + "kind": 25050, + "pubkey": "", + "tags": [ + ["type", "disconnect"] + ] +} +``` + +### Offering to connect +Used when responding to a `type:connect`. Offering to connect to that peer. +```json +{ + "kind": 25050, + "pubkey": "", + "tags": [ + ["type", "offer"], + ["p", ""] + ], + "content": { + "offer": "", + "type": "offer" + } +} +``` + +### Answering an Offer +```json +{ + "kind": 25050, + "pubkey": "", + "tags": [ + ["type", "answer"], + ["p", ""] + ], + "content": { + "sdp": "", + "type": "answer" + } +} +``` + +### Broadcasting ICE Candidate +```json +{ + "kind": 25050, + "pubkey": "", + "tags": [ + ["type", "answer"], + ["p", ""] + ], + "content": { + "candidate": "", + + } +} +``` + +Essentially, just directly feed what comes out of the WebRTC functions straight into the `content` field. It makes things cleaner and easier. \ No newline at end of file