Connecting two COTURN servers for seamless communication

Currently, I have a total of 5 webRTC peers connected through the COTURN server (turnServer1). These peers are all behind symmetric NAT, requiring the use of the TURN server to establish connections. However, due to the media streams with audio and video being sent between peers, the TURN server is reaching its bandwidth limit and I am unable to add more peers to the conversation. The network structure looks like this: https://i.sstatic.net/UKdoF.jpg

If the network were to include 10 peers, each consuming around 100kB/s of bandwidth, the TURN server would need to handle 10^10 * 100kB/s = 10000kb/s. With an increase to 100 peers, this number would rise to 1000000Kb/s. My goal is to transform this webRTC peer-to-peer network into something similar to this: https://i.sstatic.net/VgQpI.jpg

By implementing such a network architecture, the burden on the TURN server's bandwidth can be reduced by almost half. I'm wondering if it's possible to achieve this and if so, how could it be done?

Any assistance would be greatly appreciated!

Answer №1

If you have two peers connected to different TURN servers (like peer 3 and peer 10 in the example), there's no need for any special actions because TURN appears as plain UDP to the other side. This means turnServer1 doesn't even realize it's communicating with turnServer2 instead of a peer directly.

For this type of setup, you may want to consider using an SFU (selective forwarding unit) instead of a p2p/full mesh configuration with TURN servers.

Answer №2

According to Philipp, you don't need to do much as the TURN (relay) will act as your intermediary for connecting with other peers.

This resource (page 9), sourced from this GitHub discussion, provides a clear explanation:

In order to set up a WebRTC session, peers must exchange an SDP offer and answer. The SDP offer contains ICE candidates which describe how each peer can communicate. To gather these candidates, peers send requests to STUN servers to obtain their public IP address and port information. This process is known as ICE candidate gathering. Once a peer has gathered its ICE candidates, it shares them along with its SDP to the receiving peer through the signaling channel. The receiving peer then responds with its own SDP answer and ICE candidates. Peers then conduct connectivity checks based on priority of ICE candidates to establish a valid connection. If no valid connection is found, a peer can request a media relay address from the TURN server. This relay address is added to the candidate list and exchanged through the signaling channel.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Ways to execute a script from termly on NextJS using JSX

I've been utilizing termly to assist in creating legal terms for a website I'm developing. They provided me with some HTML containing a script, but I am struggling to get it to execute on a page in JSX. I attempted to use both Script and dangerou ...

Establishing specific categories for a universal element

I have been working on creating an input component that functions as a custom select for enums in my application. I have tried defining them for different types using concise one-liners but have run into various typing issues. Here is what I have so far: ...

Unlock the power of nested dynamic content creation with JavaScript

Every time I attempt to use getelementbyid on a dynamically loaded div, I receive null as the result. This occurs even after trying both window.onload = function () { and $(window).load(function() { index.html: <main > <div id="main-div"> ...

Possible conflict between CSS and JavaScript on Magento website

Problem Description: Visit this link for more details I am facing an issue with the product upload process when using certain attributes. It appears to be related to a positioning problem. Despite trying various solutions, such as removing the position at ...

In what scenarios is it more suitable to utilize style over the sx prop in Material-UI?

When it comes to MUI components, the style and sx prop serve similar purposes. While the sx prop provides some shorthand syntaxes and access to the theme object, they essentially function the same way. So, when should you opt for one over the other? ...

Removing the hash symbol in Angular: A step-by-step guide

My experience with AngularJS is new, and I am currently working on removing the # from the URLs without utilizing NODE or Express. The project is being hosted locally on MAMP, with index.html acting as the main entry point. Within the structure, there are ...

The illumination in three.js failed to display properly when viewed on Chrome through an Apache server

this illustration shows the issue at hand const directionalLight = new THREE.DirectionalLight(0xffffff, 0.65, 0); directionalLight.position.set(100, -50, 200); scene.add(directionalLight); const ambientLight = new THREE.AmbientLight(0xfff5f3); ...

Can $refs cause issues with interpolation?

I'm currently learning Vue.js and the course instructor mentioned that modifying the DOM element using $refs should not affect interpolation. In fact, any changes made directly to the DOM will be overridden by interpolation if it exists. However, in m ...

Extract the entire div including all its elements and then transmit it using the PHP mail function

Currently, I am developing a feature that allows users to send an email. The email should include only one div from the page which contains elements added using the jQuery drag and clone function. I am unsure how to copy the entire div along with its child ...

JavaScript allows users to input an array name themselves

When fetching rows from my database using AJAX, I transform them into an array with a variable identifier. Here is the PHP code: $query_val = $_GET["val"]; $result = mysql_query("SELECT * FROM eventos_main WHERE nome_evento LIKE '%$query_val%&apos ...

Issues with retrieving the scope attribute within a directive

I am currently facing an issue where I am unable to access the values stored in $scope.photoRes within my directive. When I use console.log(scope.photoRes) in the directive, it only displays an empty object. Here is the output from the console: Object {fi ...

The variable in Vue.js is failing to update, resulting in a "variable is not defined" error

I've been attempting to display the updated value of the totalQuestions variable in the HTML, but I keep encountering the following error. Can someone point out where I went wrong? https://i.sstatic.net/mEEMS.jpg HTML <label><span class="r ...

Obtaining the mouse position in JavaScript in relation to the website, preferably without relying on jQuery

I came across this code snippet on Ajaxian, but I am having trouble using cursor.y (or cursor.x) as a variable. When I call the function with it that way, it doesn't seem to work. Could there be a syntax issue or something else causing the problem? f ...

Variations of a particular software package are necessary

My current project requires Expo, React, and React-Native as dependencies. The configuration in the package.jason file looks like this: "main": "node_modules/expo/AppEntry.js", "private": true, "dependencies": { "expo": "^28.0.0", "expo-three": "^ ...

Navigating through information using Axios in React JS

Issue Currently, I am facing a challenge while trying to iterate through the data retrieved from an API call using Axios in a React.js application. The response is successfully received, but I am encountering difficulties when trying to display the inform ...

Is it more efficient to have a single global event listener or multiple event listeners of the same type in each component for productivity?

This particular mixin is a key component in numerous pages, often appearing in multiple sections within the page. data: () => ({ device: { mobile: false, tablet: false, tabletLand: false, notepad: false deskto ...

Session authentication mechanism designed to remain active only as long as the browser tab is open

Imagine you are developing a front-end application that utilizes a third-party API for authentication, with a successful authentication resulting in a JSON web token. What strategies would be most effective for storing this token and establishing a user s ...

The functionality of jQuery smooth scrolling to an anchor is only effective when the page is at the top and there is

Currently, I am working on designing a simple one-page website featuring a fixed menu that smoothly scrolls to specific sections on the page upon clicking the menu items. However, I have encountered an issue where the scrolling works perfectly only when t ...

Unable to use document.write when extracting code from the internet

I am currently developing a game using emulatorjs and ruffle. The goal is to have it all contained in a single downloadable file that can be run locally. I attempted to create another file for auto-updating purposes, but encountered issues with some of the ...

Navigating through embedded arrays in Angular

JSON Object const users = [{ "name":"Mark", "age":30, "isActive" : true, "cars":{ Owned : ["Ford", "BMW", "Fiat"], Rented : ["Ford", "BMW", "Fiat" ...