{"id":13455,"date":"2022-02-16T11:59:27","date_gmt":"2022-02-16T11:59:27","guid":{"rendered":"http:\/\/www.max-sperling.bplaced.net\/?p=13455"},"modified":"2024-02-16T10:47:36","modified_gmt":"2024-02-16T10:47:36","slug":"webrtc","status":"publish","type":"post","link":"http:\/\/www.max-sperling.bplaced.net\/?p=13455","title":{"rendered":"WebRTC"},"content":{"rendered":"<h2>1. Mesh<\/h2>\n<pre>\r\n        \/---> Peer_1 <---\\\r\n        |        \u02c4       |\r\n        \u02c5        |       \u02c5\r\n      Peer_2 <---+---> Peer_3\r\n        \u02c4        |       \u02c4\r\n        |        \u02c5       |\r\n        \\---> Peer_4 <---\/\r\n<\/pre>\n<ul>\n<li>For just a few participants. Each peer has N-1 uplinks and N-1 downlinks.<\/li>\n<\/ul>\n<h3>1.1 P2P<\/h3>\n<h4>1.1.1 LAN<\/h4>\n<pre>\r\n              Signaling\r\n         |---  server  ---|\r\n        TCP              TCP\r\n         |                |\r\n       (NAT)            (NAT)\r\n      Peer_1 ---SRTP--- Peer_2\r\n<\/pre>\n<ul>\n<li>They communicate with their local IP:Port<\/li>\n<\/ul>\n<p><strong>Procedure<\/strong><\/p>\n<ol>\n<li>The peers negotiate a connection setup via the Signaling server.<\/li>\n<li>The peers trying to setup an SRTP connection to each other.<\/li>\n<\/ol>\n<h4>1.1.2 WAN<\/h4>\n<pre>\r\n              Signaling\r\n         |---  server  ---|\r\n        TCP              TCP\r\n         |                |\r\nPeer_1 |NAT| ---SRTP--- |NAT| Peer_2\r\n         |                |\r\n        UDP              UDP\r\n         |                |\r\n       STUN             STUN\r\n      server           server\r\n<\/pre>\n<ul>\n<li>They communicate with their public IP:Port<\/li>\n<li>This works only with non symmetric NATs<\/li>\n<\/ul>\n<p><strong>Procedure<\/strong><\/p>\n<ol>\n<li>The peers requesting from a STUN server their public IP:Port.<br \/>\n      This creates an entry in the NAT-table for later on.<\/li>\n<li>The peers negotiate a connection setup via the Signaling server.<\/li>\n<li>The peers trying to setup an SRTP connection to each other.<br \/>\n      This works based on the entry in the NAT-table.<sup>1<\/sup><\/li>\n<\/ol>\n<p><sup>1<\/sup> For Full Cone NATs it would also work without the NAT-table entry.<\/p>\n<h3>1.2 TURN<\/h3>\n<pre>\r\n              Signaling\r\n         |---  server  ---|\r\n        TCP              TCP\r\n         |                |\r\nPeer_1 |NAT| ----||---- |NAT| Peer_2\r\n         |       ||       |\r\n        UDP     SRTP     UDP\r\n         |       ||       |\r\n       STUN     TURN    STUN\r\n      server   server  server\r\n<\/pre>\n<ul>\n<li>This also works with symmetric NATs<\/li>\n<\/ul>\n<p><strong>Procedure<\/strong><\/p>\n<ol>\n<li>The peers requesting from a STUN server their public IP:Port.<\/li>\n<li>The peers negotiate a connection setup via the Signaling server.<\/li>\n<li>The peers trying to setup an SRTP connection to each other. It fails.<\/li>\n<li>The peers connect to a TURN server<sup>1<\/sup>, which relays their SRTP connection.<\/li>\n<\/ol>\n<p><sup>1<\/sup> A TURN server is an ICE candidate negotiated via the Signaling sever.<\/p>\n<hr>\n<h2>3 SFU<\/h3>\n<pre>\r\n          Peer_1  Peer_2\r\n           \u2193\u2191\u2191\u2191    \u2193\u2191\u2191\u2191\r\n          |------------|\r\n          |    SFU     |\r\n          |------------|\r\n           \u2191\u2193\u2193\u2193    \u2191\u2193\u2193\u2193\r\n          Peer_3  Peer_4\r\n<\/pre>\n<ul>\n<li>For more then just a few participants. Each peer has 1 uplink and N-1 downlinks.<\/li>\n<\/ul>\n<hr>\n<h2>4 MCU<\/h3>\n<pre>\r\n          Peer_1   Peer_2\r\n            \u21c5        \u21c5\r\n          |------------|\r\n          |    MCU     |\r\n          |------------|\r\n            \u21c5        \u21c5\r\n          Peer_3   Peer_4\r\n<\/pre>\n<ul>\n<li>For way more then just a few participants. Each peer has 1 uplink and 1 downlink.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>1. Mesh \/&#8212;> Peer_1 Peer_4<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false},"categories":[55],"tags":[],"_links":{"self":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/13455"}],"collection":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=13455"}],"version-history":[{"count":1,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/13455\/revisions"}],"predecessor-version":[{"id":16832,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=\/wp\/v2\/posts\/13455\/revisions\/16832"}],"wp:attachment":[{"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=13455"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=13455"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.max-sperling.bplaced.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=13455"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}