GoodMan
GoodMan

Reputation: 650

Should I use webRTC alongside Socket.IO if I want a live chat ability beside the real-time video streaming?

What I am trying to do is to create a simple virtual classroom project like Adobe connect, but obviously simpler, using Flutter and NodeJS, and I need the following options:

  1. Real-time video or only voice streaming
  2. Live chat box
  3. Screen sharing ability
  4. File sharing ability(Like PDF or PowerPoint or other text/doc files)
  5. Whiteboard

As I searched so far I found that it seems WebRTC works for video/voice streaming and also screen sharing as well.

Also most of the livechat projects using Socket.IO.

My main question here is to know can I use only WebRTC for both real-time video/voice streaming and also live chat as well? Is it a good idea or it's better to combine Socket.IO and WebRTC together?

Furthermore I want to know can I use each of those libraries for File-Sharing purposes?

Upvotes: 0

Views: 6211

Answers (3)

Alberto Tamayo
Alberto Tamayo

Reputation: 381

For real-time video streaming wit WebRTC you need this elements:

  • Emit video/voice signal (Uses STUN/TURN Server ex: coturn)
  • Emit Signals (Uses websockets ex: Socket.io, pusher, etc)
  • Emit ICECandidate (Uses websockets ex: Socket.io, pusher, etc)

As you see in this case you can use Socket.io but only for Emit Signals and ICECandidate.

Upvotes: 0

Qiulang
Qiulang

Reputation: 12405

Using WebRTC requires signaling server and signaling is often implemented using websocket, check this mdn article Signaling and video calling

And with websocket you can implement livechat too, so it is not an either or situation but both quite often.

Upvotes: 1

Ivan
Ivan

Reputation: 778

WebRTC gives you lower latency and a lot of functionality for conferencing out of the box. So for video/audio calls and screen sharing this is definitely a better choice.

Also, there's an option to use p2p communication which reduces latency even more and saves you resources on the server-side. Though if you intend to support many participants it looks less beneficial - you will need to maintain n-1 connections for each user if you have n users in total.

For live chat, whiteboard and file sharing there would be no big difference in terms of performance. Things to consider:

  • WebRTC is more complex technology than websockets to setup and support
  • There might be opensource solutions for this features, i would make a decision based on what you can reuse in your project
  • You can use WebRTC for some of the features and websockets for others

can I use only WebRTC for both real-time video/voice streaming and also live chat as well

Yes you can, there's a RTCDataChannel interface for exchanging arbitrary data. It can be used for live chat / whiteboard / file transfer.

As a good example, there's an opensource project peercalls, that implements chat and file transfer via WebRTC through the same connection that is used for conferencing.

Websockets can be used for file transfer as well, check out this library.

Upvotes: 6

Related Questions