# 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.) ### 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"], ["r", ""] ] } ``` ### Closing ```json { "kind": 25050, "pubkey": "", "tags": [ ["type", "disconnect"], ["r", ""] ] } ``` ### Offering to connect Used when responding to a `type:connect`. Offering to connect to that peer. ```json { "kind": 25050, "pubkey": "", "tags": [ ["type", "offer"], ["p", ""], ["r", ""] ], "content": { "offer": "", "type": "offer" } } ``` ### Answering an Offer ```json { "kind": 25050, "pubkey": "", "tags": [ ["type", "answer"], ["p", ""], ["r", ""] ], "content": { "sdp": "", "type": "answer" } } ``` ### Broadcasting ICE Candidate ```json { "kind": 25050, "pubkey": "", "tags": [ ["type", "candidate"], ["p", ""], ["r", ""] ], "content": { "candidate": "", } } ``` Essentially, just directly feed what comes out of the WebRTC functions straight into the `content` field. It makes things cleaner and easier.