https://github.com/Sh3B0/realtime-web Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code + Explore + All features + Documentation + GitHub Skills + Blog * Solutions + For + Enterprise + Teams + Startups + Education + By Solution + CI/CD & Automation + DevOps + DevSecOps + Case Studies + Customer Stories + Resources * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles + Repositories + Topics + Trending + Collections * Pricing [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} Sh3B0 / realtime-web Public * Notifications * Fork 1 * Star 19 Comparing WebSocket, WebRTC, and WebTransport under packet loss License MIT license 19 stars 1 fork Star Notifications * Code * Issues 0 * Pull requests 0 * Actions * Projects 0 * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Security * Insights Sh3B0/realtime-web This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 1 branch 1 tag Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/S] Use Git or checkout with SVN using the web URL. [gh repo clone Sh3B0/] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit Git stats * 27 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time client videos webrtc websocket webtransport .gitignore CITATION.cff LICENSE README.md run.sh View code realtime-web Demos Experiment details Local testing README.md realtime-web Experimenting with WebSocket, WebRTC, and WebTransport by streaming 2500 coordinates from server to client to visualize. Demos 0% Packet loss 1.mp4 15% Packet loss (unreliable WebRTC/WebTransport) 2.mp4 15% Packet loss (reliable WebRTC/WebTransport) 3.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. WebRTC and WebTransport maintained a stable and efficient behavior since dropped packets are not retransmitted. The third experiment is the same as the second one except now, WebRTC data channel is set up for ordered delivery and a maxRetransmission value of 5 to ensure reliability. WebTransport server used a server-initiated, reliable, and unidirectional stream which is better suited for this experiment (since data flows only in one direction). We can see WebRTC packets often arrive in bulk since ordered delivery enforces a large buffer (newer packets were buffered waiting for older ones to be retransmitted). This results in an overall behavior not better than WebSocket. In the end, WebTransport was the fastest protocol to deliver all the coordinates with the smallest number of packets transmitted. 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 git clone https://github.com/Sh3B0/realtime-web.git cd realtime-web 2. Create locally trusted certs using mkcert mkdir certs && cd certs mkcert -install mkcert localhost 3. Run a server (use similar commands for webtransport and webrtc) ./run.sh websocket 4. Simulating packet loss (use del instead of add to remove rules) sudo tc qdisc add dev lo root netem loss 15% 5. Run client ./run.sh client chromium --origin-to-force-quic-on=localhost:8001 http://localhost:3000 About Comparing WebSocket, WebRTC, and WebTransport under packet loss Topics websocket webrtc webtransport Resources Readme License MIT license Stars 19 stars Watchers 2 watching Forks 1 fork Releases 1 v1.0.0 Latest Nov 9, 2022 Languages * JavaScript 49.8% * Go 36.9% * HTML 12.1% * Shell 1.2% Footer (c) 2022 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.