avi dahan
avi dahan

Reputation: 559

Webrtc Data channel server to client

I'm trying to create a webrtc data channel between client to server. (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. 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. Thanks A lot!:)

Upvotes: 1

Views: 2545

Answers (3)

Miao ZhiCheng
Miao ZhiCheng

Reputation: 657

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. Is it currently possible?

Upvotes: 1

You need a signalling server to interchange SDP between the browser and whatever the browser talks to in order to set up the call. 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. If it's behind another NAT, you'll need one.

Upvotes: 2

Tsahi Levent-Levi
Tsahi Levent-Levi

Reputation: 2386

You've got it all wrong...

To get WebRTC started, you'll need a signaling server. To be able to connect one browser to another, you first need the two browsers to exchange SDP blobs between them. And for that, you need some signaling server to coordinate this process (also known as 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). The TURN server will relay your data channel's traffic if the browsers will be unable to communicate directly peer-to-peer.

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

Upvotes: 1

Related Questions