Now we are already familiar WebRTC technology and it’s RTCDataChannel API through our last couple of WebRTC posts . WebRTC performance is very high when we transferring video and audio . Isn’t ? As well as audio and video with the help of RTCDataChannel API , WebRTC can send arbitrary data also . Let us start about WebRTC’s RTCDataChannel API through this post .
If your new to this WebRTC series , Please go though the last couple of post about WebRTC technology .
Introduction to WebRTC : Introduction of webRTC in Modern Browsers
getUsermedia API : Access user media with getUserMedia API
RTCPeerconnection API : Walk through WebRTC RTCPeerConnection API
RTCDataChannel API
RTCDataChannel API allows you to send real-time data over the wire . ie ) It enables peer to peer exchange of arbitrary data with low latency and high throughput . We use this API for text based chatting , file transfer , remote desktop applications etc. This WebRTC API is much faster than other application because it’s direct communication between the browsers .
There are some RTCDataChanel API event handlers used in WebRTC . It includes :
- RTCDataChannel.onopen – This event is active when the open event is fired . It send the data when data connection has been established .
- RTCDataChannel.onmessage -It is a message event . The event is active when the message is available on data channel .
- RTCDataChannel.onclose – This event is active when the close event is fired . This event send a notification for data connection close .
- RTCDataChannel.onerror – Error handling event .
These are the 2 main methods used in theRTCDataChanel API :
- RTCDataChannel.close( ) – This method close the data channel .
- RTCDataChannel.send( ) – Method helps to send the data over the channel . It can send data as bulb , string or an ArrayBuffer .
If you are interested and you want to test with writing webRTC application from scratch , Just go though our posts , Write a WebRTC Application – Programming from scratch
- Part 1 – How to Create a Simple App Like A Pro
- Part 2 – Create a server with Node.js for the App
- Part 3 – Design your first WebRTC App
Conclusion
With this post , You understand about the next API of webRTC . Now we covered all of the webRTC API’s . Next post onwards , we will start to build some sample webRTC application and let us look these API’s programatically in browser .
If you have any feedback or tips , We are really happy to hear them . See you again !!
Leave a Reply