O'Reilly logo

Learning WebRTC by Dan Ristic

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The RTCDataChannel object

Now that we understand the underlying technologies at play, we can start learning how the actual RTCDataChannel object API works. The great thing is that this API is much less complex than the underlying workings of the SCTP. The main function to create a channel comes from an already established RTCPeerConnection object:

var peerConnection = new RTCPeerConnection();

// Establish your peer connection using signaling here

var dataChannel = peerConnection.createDataChannel("myLabel", dataChannelOptions);

This is all you need to get started! The WebRTC API will take care of everything else on the browser's internal layer. This will all happen once signaling has been performed and the connection has been established. You can ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required