make room id optional depending on use

This commit is contained in:
Jack Chakany 2023-03-21 13:00:34 -04:00 committed by GitHub
parent 7328922aad
commit 16d577fdf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

22
100.md
View File

@ -1,10 +1,16 @@
# NIP-100 WebRTC
NIP-100 WebRTC
==============
`draft` `optional` `author:jacany`
This NIP defines how to do WebRTC communication over nostr.
---------------------------------
## Defining Rooms
Rooms are essentially the space that you will be connected to. This must be defined by a `r` tag following the pubkey of the person you are connected to or some other identifier (maybe a lobby id for a joinable voice channel, etc.)
Rooms are essentially the space that you will be connected to. How rooms are defined depends.
1. Is this a one-on-one call? In that case just use the `p` tag.
2. If it is a group call (multiple people), then you will need both the `p` tag for communicating who the event is for, and the `r` tag for defining the room id.
In that case, when you are sending `connect` or `disconnect`, the usage of the `p` and `r` tag varies on your requirements
## Peers
Who the client connects to can be chosen by the client. Ex: you can connect to everyone peer-to-peer or a WebRTC media server that is listening on nostr relays.
@ -24,7 +30,7 @@ The connection ID is inferred from the provided pubkey.
"pubkey": "<sender pubkey>",
"tags": [
["type", "connect"],
["r", "<plaintext room id>"]
...roominfo
]
}
```
@ -37,7 +43,7 @@ This is used when disconnecting from everybody else. Ex: when browser tab is clo
"pubkey": "<sender pubkey>",
"tags": [
["type", "disconnect"],
["r", "<plaintext room id>"]
...roominfo
]
}
```
@ -51,7 +57,7 @@ Used when responding to a `type:connect`. Offering to connect to that peer.
"tags": [
["type", "offer"],
["p", "<reciever>"],
["r", "<encrypted room id>"]
["r", "<optional encrypted room id>"]
],
"content": {
"offer": "<offer>",
@ -68,7 +74,7 @@ Used when responding to a `type:connect`. Offering to connect to that peer.
"tags": [
["type", "answer"],
["p", "<reciever>"],
["r", "<encrypted room id>"]
["r", "<optional encrypted room id>"]
],
"content": {
"sdp": "<sdp>",
@ -85,11 +91,11 @@ Used when responding to a `type:connect`. Offering to connect to that peer.
"tags": [
["type", "candidate"],
["p", "<reciever>"],
["r", "<encrypted room id>"]
["r", "<optional encrypted room id>"]
],
"content": {
"candidate": "<sdp>",
<misc>
...misc
}
}
```