Hacker News new | ask | show | jobs
by andrethegiant 2227 days ago
What advantages does sending data over WebRTC have over sending data over websockets?
2 comments

DataChannels are transmitted over the same UDP/ICE "connection" that is used to transmit audio and video packets. So if you plan to send real-time data (for example: real-time subtitles, metadata related to the current video position, etc) by sending such a data over DataChannel it will reach the remote without delay over the audio/video. If you use WebSocket to transmit the data, there may desynchronization between audio/video and data because they use a different network path.
You said it yourself: it can be done peer 2 peer. A websocket will have a server in between.