Time is money, so I’m gonna get to the point. In this article, I’ll show you how to write a video chat application which allows sharing both video and audio between two connected users. It’s quite simple, nothing fancy but good for training in JavaScript language and to be more precise WebRTC technology and Node.js.
Web Real-Time Communications WebRTC in short, is an HTML5 specification that allows you to communicate in real-time directly between browsers without any third-party plugins. WebRTC can be used for multiple tasks (even file sharing) but real-time peer-to-peer audio and video communication is obviously the primary feature and we will focus on those in this article.
What WebRTC does is to allow access to devices, you can use a microphone, a camera and share your screen with help from WebRTC and do all of that in real-time.
WebRTC is a complex topic where many technologies are involved. However, establishing connections, communication and transmitting data are implemented through a set of JS APIs. The primary APIs include:
To make a remote connection between two or more devices you need a server. In this case, you need a server that handles real-time communication. You know that Node.js is built for real-time scalable applications. To develop two-way connection apps with free data exchange, you would probably use WebSockets that allows opening a communication session between a client and a server. Requests from the client are processed as a loop, more precisely the event loop, which makes Node.js a good option because it takes a “non-blocking” approach to serve requests and thus, achieves low latency and high throughput along the way.
#javascript #chat #nodejs #webrtc