realtime-web

Comparing WebSocket, WebRTC, and WebTransport under packet loss

https://github.com/sh3b0/realtime-web

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (8.9%) to scientific vocabulary

Keywords

webrtc websocket webtransport
Last synced: 6 months ago · JSON representation ·

Repository

Comparing WebSocket, WebRTC, and WebTransport under packet loss

Basic Info
Statistics
  • Stars: 142
  • Watchers: 5
  • Forks: 6
  • Open Issues: 0
  • Releases: 1
Topics
webrtc websocket webtransport
Created over 3 years ago · Last pushed about 3 years ago
Metadata Files
Readme License Citation

README.md

realtime-web

Experimenting with WebSocket, WebRTC, and WebTransport by streaming 2500 coordinates from server to client to visualize.

Checkout the discussion on HackerNews

Demos

0% Packet loss https://user-images.githubusercontent.com/40727318/215340433-ac2543e7-e2eb-4c4f-b3c1-d5adc4abffd3.mp4
15% Packet loss (unreliable WebRTC/WebTransport) https://user-images.githubusercontent.com/40727318/215340455-66b51c24-9015-4086-9453-4230cf72cea6.mp4
15% Packet loss (reliable WebRTC/WebTransport) https://user-images.githubusercontent.com/40727318/215340465-ebe2c5cf-839c-4822-9df6-eb177fe2bb77.mp4

Experiment details

All servers are written in Go and hosted locally. All connections use HTTPS with self-signed certificates, connection establishment period is excluded from the time graph.

In the first experiment, WebRTC data channel and WebTransport server are operating in unreliable modes, undelivered packets are not retransmitted. However, since the network is reliable, we can see almost no performance differences between the protocols.

In the second experiment, WebRTC data channel and WebTransport server are still operating in unreliable modes, but any packet may be dropped with a probability of 15%. We can see WebSocket performance starting to suffer due to TCP head-of-line blocking. Results varied over multiple runs, with WebTransport constantly managing to deliver more messages than WebRTC.

In the third experiment, all protocols are operating in reliable modes. WebRTC uses a maxRetransmission value of 5 and WebTransport server uses a server-initiated unidirectional stream. Interestingly, WebTransport maintained a very stable and efficient behavior while WebRTC suffered what looks like a sender-side head-of-line blocking.

Additional notes:

  • UDP Receive buffer size was incremented as suggested in https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size

  • No limits were specified on packet size or how protocols buffer packets.

  • Libraries used: gorilla/websocket, pion/webrtc, and adriancable/webtransport-go

  • Client is written in pure HTML/CSS/JS. Static files were served by JetBrains debugging server, an additional Go server for static files is included in this repo. Bootstrap and Chart.js were used.

Local testing

  1. Clone repo bash git clone https://github.com/Sh3B0/realtime-web.git cd realtime-web

  2. Create locally trusted certs using mkcert bash mkdir certs && cd certs mkcert -install mkcert localhost

  3. Run a server (use similar commands for webtransport and webrtc) bash ./run.sh websocket

  4. Simulating packet loss (use del instead of add to remove rules) bash sudo tc qdisc add dev lo root netem loss 15%

  5. Run client bash ./run.sh client chromium --origin-to-force-quic-on=localhost:8001 http://localhost:3000

Owner

  • Name: Ahmed Nouralla
  • Login: Sh3b0
  • Kind: user
  • Company: Innopolis University

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
  - family-names: Nouralla
    given-names: Ahmed
    orcid: https://orcid.org/0000-0001-8526-4838
title: "Realtime Web"
version: 1.0.0
doi: 10.5281/zenodo.7308892
date-released: 2022-11-10

GitHub Events

Total
  • Watch event: 18
  • Fork event: 2
Last Year
  • Watch event: 18
  • Fork event: 2

Dependencies

webrtc/go.mod go
  • github.com/google/uuid v1.3.0
  • github.com/gorilla/websocket v1.5.0
  • github.com/pion/datachannel v1.5.2
  • github.com/pion/dtls/v2 v2.1.5
  • github.com/pion/ice/v2 v2.2.11
  • github.com/pion/interceptor v0.1.11
  • github.com/pion/logging v0.2.2
  • github.com/pion/mdns v0.0.5
  • github.com/pion/randutil v0.1.0
  • github.com/pion/rtcp v1.2.10
  • github.com/pion/rtp v1.7.13
  • github.com/pion/sctp v1.8.2
  • github.com/pion/sdp/v3 v3.0.6
  • github.com/pion/srtp/v2 v2.0.10
  • github.com/pion/stun v0.3.5
  • github.com/pion/transport v0.13.1
  • github.com/pion/turn/v2 v2.0.8
  • github.com/pion/udp v0.1.1
  • github.com/pion/webrtc/v3 v3.1.47
  • golang.org/x/crypto v0.0.0-20221010152910-d6f0a8c073c2
  • golang.org/x/net v0.0.0-20221004154528-8021a29435af
  • golang.org/x/sys v0.0.0-20221010170243-090e33056c14
webrtc/go.sum go
  • 134 dependencies
websocket/go.mod go
  • github.com/gorilla/websocket v1.5.0
websocket/go.sum go
  • github.com/gorilla/websocket v1.5.0
webtransport/go.mod go
  • github.com/adriancable/webtransport-go v0.1.0
  • github.com/cheekybits/genny v1.0.0
  • github.com/fsnotify/fsnotify v1.4.9
  • github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0
  • github.com/lucas-clemente/quic-go v0.25.0
  • github.com/marten-seemann/qpack v0.2.1
  • github.com/marten-seemann/qtls-go1-16 v0.1.4
  • github.com/marten-seemann/qtls-go1-17 v0.1.0
  • github.com/marten-seemann/qtls-go1-18 v0.1.0-beta.1
  • github.com/nxadm/tail v1.4.8
  • github.com/onsi/ginkgo v1.16.4
  • golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
  • golang.org/x/mod v0.4.2
  • golang.org/x/net v0.0.0-20210428140749-89ef3d95e781
  • golang.org/x/sys v0.0.0-20210510120138-977fb7262007
  • golang.org/x/text v0.3.6
  • golang.org/x/tools v0.1.1
  • golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
  • gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
webtransport/go.sum go
  • 257 dependencies