Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebRTC: can data channel be used to signalling?

I'm working on a project which implement webRTC technology and I was wondering if I could use data channel to signaling like webSockets or data channels can just replace peerconnection by sending global datas and so I'll need to use webSockets to make the signaling part to the server?

like image 757
Frumba Avatar asked Nov 29 '12 07:11

Frumba


People also ask

What is data channel in WebRTC?

What is a data channel? A WebRTC data channel lets you send text or binary data over an active connection to a peer. In the context of a game, this lets players send data to each other, whether text chat or game status information.

How does WebRTC signaling work?

WebRTC signaling refers to the process of setting up, controlling, and terminating a communication session. In order for two endpoints to begin talking to one another, three types of information must be exchanged: Session control information determines when to initialize, close, and modify communications sessions.

How does WebRTC send data?

Sending a message on a RTCDataChannel is done by calling the send() function with the data we want to send. The data parameter for this function can be either a string, a Blob , an ArrayBuffer or and ArrayBufferView . The remote peer will receive messages sent on a RTCDataChannel by listening on the message event.

What is a data channel?

data channel An information route and associated circuitry that is used for the passing of data between systems or parts of systems. In an interface that has a number of parallel channels the channels are usually separately dedicated to the passing of a single type of information, e.g. data or control information.


1 Answers

Actually, the answer is Yes.

Let me elaborate: once a PeerConnection has been connected (by whatever means - WebSockets, https, etc), then you can re-negotiate (new CreateOffer/CreateAnswer/etc) and send them over a DataChannel. This means in some cases noticeably faster renegotiations, especially for cases where both endpoints are far from the server, or if both are in the same LAN, etc. (Also lower load on the server, though that might not matter, and no reliance on the server maintaining the call state.)

You could also use a DataChannel over a PeerConnection to a server acting as conference hub or signaling server both for renegotiations (in a conference) and to initiate a connection with someone else connected to the hub or server.

The answer is No if it's "I want to connect directly to someone else random without going through a server"; you need a connected PeerConnection first. You can use IPoAC if you want to exchange the offer and answer. After that per above you can use DataChannels (it will likely be a bit faster).

like image 174
jesup Avatar answered Nov 03 '22 00:11

jesup