What is WebRTC

and how does we use it at Dyte

Jesús Leganés-Combarro "piranna"

for Dyte Inc.

JCP

March 2022

What's WebRTC

JCP

What's WebRTC

  • Open specification and API for Real Time Communications
    • Voice & video (MediaStreamTracks)
    • Raw data (DataChannels)
    • Build on top of RTP, SCTP, SDP & ICE
    • Doesn't spec signaling on purpose
      • Left to the developers
      • RFC 1149 🐦

JCP

What's WebRTC

  • RTP: Real-time Transport Protocol
    • Stream of audio & video
  • SCTP: Stream Control Transmission Protocol
    • DataChannels
  • SDP: Session Description Protocol
    • What to connect
  • ICE: Interactive Connection Establishment
    • Where to connect (public IPs)

JCP

What's WebRTC

  • Initially targeted for browser-to-browser
  • Also used for browser-to-server communications
    • Mediasoup, Kurento, Meedoze, Jitsi, Pion, LiveKit...
    • Each one with its own architecture and use case

JCP

What's WebRTC

  • Proposed in October 2011
  • First experimental implementations for audio & video about September 2012
  • First experimental implementations for data circa March 2013
    • Shameless plug: DataChannels-polyfill in October 2012 😉

JCP

Use cases

JCP

Use cases

  • Video conference
    • WhatsApp, Skype, Facebook Messenger, Slack Huddle, Discord
    • Anything web browser capable (Zoom... sort of)
  • VoIP
  • Low-latency games networking
  • Network tunneling

JCP

Use cases

  • File transfers
    • ShareIt! (mine! 😋)
    • WebTorrent, PeerCDN
  • Video streaming
    • Popcorn time (HLS over WebTorrent)
    • ChromeCast
    • Clubhouse (only audio)
    • Twitch

JCP

Related APIs

JCP

getUserMedia

# PRESENTING CODE

JCP

Related APIs

  • getUserMedia
  • WebAudio
  • FileSystem API
  • Canvas
  • FileReader
  • MediaSource

JCP

How we use WebRTC at

JCP

WebRTC at Dyte

  • Powered by Mediasoup SFU
    • `room-node` code based on EduMeet
    • forked from Mediasoup-demo
  • Client <-> Server
    • Audio & Video streams (mediasoup-client)
  • Server <-> Server (remote-router-provider)
    • Audio & Video streams
    • DataChannels (second-stage signaling)

JCP

Server to Server

  • Using PipeTranports as transport layer
  • Moleculer ServiceBroker as first-stage signaling
  • DataChannel as second-stage signaling
    • Create and control Mediasoup objects
    • Remote Mediasoup
  • One extra DataChannel per stream
    • Propagate stream events & commands

JCP

How can we use it in

JCP

The Future™️

  • P2P4121
    • Peer-to-Peer for one-to-one
  • HTTP + DataChannels instead of WebSockets
  • Direct Messages between chat participants
  • Efemeral file transfers
    • Directly between users
    • Broadcasted to all of them
      • Maybe better WebTorrent?

JCP

What is WebRTC

By Jesús Leganés-Combarro