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?
I’m working on a project which implement webRTC technology and I was wondering if
Share
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).