简体   繁体   English

Webrtc数据通道服务器到客户端

[英]Webrtc Data channel server to client

I'm trying to create a webrtc data channel between client to server . 我正在尝试在客户端到服务器之间创建一个webrtc 数据通道 (the data is different between each client so i need a unique connection between each client to my server) (每个客户端之间的数据不同,因此我需要每个客户端与服务器之间的唯一连接)

After some research i concluded that i need to use a turn server and when a client connects to the turn server on the server side i need to act as the other peer and create the data channel , at least that what i think. 经过一些研究,我得出的结论是我需要使用转弯服务器,并且当客户端在服务器端连接到转弯服务器时,我需要充当另一个对等方并创建数据通道 ,至少我认为是这样。

I don't need any signalling only pure webrtc connection. 我不需要任何信号仅纯webrtc连接。 i tried to use this turn server https://github.com/coturn/coturn but i will deeply appreciate any working example for server to client data channel without any signalling just pure webrtc . 我尝试使用此转弯服务器https://github.com/coturn/coturn,但我将深深体会到服务器到客户端数据通道的任何有效示例,而没有任何信号只是纯webrtc Thanks A lot!:) 非常感谢!:)

You've got it all wrong... 你错了...

To get WebRTC started, you'll need a signaling server. 要启动WebRTC,您需要一个信令服务器。 To be able to connect one browser to another, you first need the two browsers to exchange SDP blobs between them. 为了能够将一个浏览器连接到另一个浏览器,您首先需要两个浏览器在它们之间交换SDP Blob。 And for that, you need some signaling server to coordinate this process (also known as offer-answer). 为此,您需要一些信令服务器来协调此过程(也称为offer-answer)。

Once you get these messages going via a signaling server, you might end up needing a TURN server (and most likely will need a STUN server - which you get for free from most TURN server implementations). 一旦通过信令服务器传送了这些消息,您可能最终需要TURN服务器(并且很可能需要STUN服务器-您可以从大多数TURN服务器实现中免费获得)。 The TURN server will relay your data channel's traffic if the browsers will be unable to communicate directly peer-to-peer. 如果浏览器将无法直接进行对等通信,则TURN服务器将中继您的数据通道的流量。

There are quite a few signaling servers out there for you to use. 有很多信令服务器供您使用。 Here's one to try out: https://github.com/feross/simple-peer 这里是一个尝试: https : //github.com/feross/simple-peer

You need a signalling server to interchange SDP between the browser and whatever the browser talks to in order to set up the call. 您需要一个信令服务器来在浏览器和浏览器所交谈的对象之间交换SDP以便建立呼叫。 This signalling server can be the same as your media server - but it doesn't have to be. 该信令服务器可以与您的媒体服务器相同,但是不必相同。 If your media server is on the open Internet, you don't need a TURN server. 如果您的媒体服务器在开放的Internet上,则不需要TURN服务器。 If it's behind another NAT, you'll need one. 如果它在另一个NAT之后,则需要一个。

I totally understand what you want to achieve here, in fact we had the same requirement in our project too. 我完全理解您要在这里实现的目标,实际上,我们在项目中也有相同的要求。

Please have a look at the answer I have at: WebRTC Data Channel server to clients UDP communication. 请看一下我的回答: WebRTC数据通道服务器到客户端的UDP通信。 Is it currently possible? 目前可以吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM