From d8315a650e3a272d3e57408790bfd879a868c3e1 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Mon, 3 Oct 2022 11:44:30 +0200 Subject: update example protocol --- readme.md | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'readme.md') diff --git a/readme.md b/readme.md index 2dd6c7b..1a0dc80 100644 --- a/readme.md +++ b/readme.md @@ -136,22 +136,32 @@ system works as follows: ## Protocol The protocol packets are defined in [packets.d.ts](./common/packets.d.ts). Here -is an (simplified) example of how the protocol is used. - -**THIS IS OBSOLETE! The new protocol is quite similar but uses encryption** +are some simplified examples of how the protocol is used. ``` S->C { init: { your_id: 5, version: "..." } } ---- # Your join packet will be the first one. -S->C { client_join: { id: 5, name: "bob" } } -S->C { client_join: { id: 3, name: "alice" } } ----- # Now publish your ICE candidates -C->S { relay: { message: { ice_candiate: } } } ----- # Whenever you change your streams change: +S->C { client_join: { id: 5 } } +S->C { client_join: { id: 3 } } +---- # The server doesnt know people's names so they identify themselves. +S->C { message: { sender: 3, message: } } +---- # You should do that too. +C->S { relay: { message: } } +---- # Publish your ICE candidates. +C->S { relay: { message: }> } } +---- # If you create a resource, tell others about it: +C->S { relay: { message: } } +---- # If somebody is interested in this resource, they will request you to transmit. +S->C { message: { sender: 3, message: } } +---- # Whenever you change your tracks/data channels: ---- # Send an offer to everybody -C->S { relay: { recipient: 3, offer: } } ----- # Alice answers -S->C { message: { sender: 3, message: { offer: } } } +C->S { relay: }> } +---- # Await answer: +S->C { message: { sender: 3, message: }> } } ---- # In case the server uses a reverse-proxy that disconnects inactive connections: Ping every 30s C->S { ping: null } ``` + +If you decide to implement this protocol, please make sure it is compatible, +especially ensure that channels/tracks are only added on request and to not +reuse existing identifiers for new protocol packets. -- cgit v1.2.3-70-g09d2