Search code examples
websocketsocket.iowebrtcprotocolscommunication

Websocket or WebRTC for chat application?


1) websocket protocol can send and receive voice and video call?

2) web RTC can send and receive text message ?

3) websocket or webRTC whom has more secure for use in chat application ?

4) what is difference between video call and streaming video ?

5) websocket or webRTC whom are faster in communication ? ( send and receive text message , voice and video call )

6) can we use from websocket and webRTC in same application together ?

Thank you very much .


Solution

    1. Websocket is a protocol which is based on HTTP, meaning that you can either send or receive any data via a websocket(wss), but the downside is that websocket can't capture video data.

    2. You can use webrtc.datachannel to send or receive any data, webrtc.datachannel is based on P2P (Peer-to-peer). You can visit this datachannel.

    3. You can use wss to make websocket more secure, plus you can choose wss to build a websocket connection. WebRTC is based on DTLS, so it is more secure(for packet sniffing). On the other hand, since WebRTC utilizes P2P, a user can trace another user's IP Address. You must use WebRTC via HTTPS or wss, or else it won't work.

    4. Websocket needs a server, where WebRTC is a P2P connection, so WebRTC is faster.

    5. Yes, you need a signal server to exchange SDP for WebRTC. You can use websocket to build the signal server.