{"id":13622591,"url":"https://github.com/Sh3b0/realtime-web","last_synced_at":"2025-04-15T09:33:01.207Z","repository":{"id":70269252,"uuid":"542207315","full_name":"Sh3b0/realtime-web","owner":"Sh3b0","description":"Comparing WebSocket, WebRTC, and WebTransport under packet loss","archived":false,"fork":false,"pushed_at":"2023-02-05T20:04:24.000Z","size":47293,"stargazers_count":142,"open_issues_count":0,"forks_count":6,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-13T15:42:57.732Z","etag":null,"topics":["webrtc","websocket","webtransport"],"latest_commit_sha":null,"homepage":"https://youtu.be/dLejz4S_K_c","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Sh3b0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-09-27T17:25:24.000Z","updated_at":"2025-03-24T20:38:08.000Z","dependencies_parsed_at":"2023-02-28T03:30:50.666Z","dependency_job_id":null,"html_url":"https://github.com/Sh3b0/realtime-web","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sh3b0%2Frealtime-web","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sh3b0%2Frealtime-web/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sh3b0%2Frealtime-web/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sh3b0%2Frealtime-web/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sh3b0","download_url":"https://codeload.github.com/Sh3b0/realtime-web/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249043100,"owners_count":21203416,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["webrtc","websocket","webtransport"],"created_at":"2024-08-01T21:01:21.404Z","updated_at":"2025-04-15T09:33:00.885Z","avatar_url":"https://github.com/Sh3b0.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# realtime-web\nExperimenting with WebSocket, WebRTC, and WebTransport by streaming 2500 coordinates from server to client to visualize.\n\u003e Checkout the discussion on [HackerNews](https://news.ycombinator.com/item?id=34137974)\n\n## Demos\n\n\u003cdetails\u003e\n\u003csummary\u003e0% Packet loss\u003c/summary\u003e\n\nhttps://user-images.githubusercontent.com/40727318/215340433-ac2543e7-e2eb-4c4f-b3c1-d5adc4abffd3.mp4\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e15% Packet loss (unreliable WebRTC/WebTransport)\u003c/summary\u003e\n\nhttps://user-images.githubusercontent.com/40727318/215340455-66b51c24-9015-4086-9453-4230cf72cea6.mp4\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e15% Packet loss (reliable WebRTC/WebTransport)\u003c/summary\u003e\n\nhttps://user-images.githubusercontent.com/40727318/215340465-ebe2c5cf-839c-4822-9df6-eb177fe2bb77.mp4\n\n\u003c/details\u003e\n\n## Experiment details\n\nAll 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.\n\n**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.\n\n**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.\n\n**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.\n\n**Additional notes:**\n\n- UDP Receive buffer size was incremented as suggested in https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size\n\n- No limits were specified on packet size or how protocols buffer packets.\n- Libraries used: [gorilla/websocket](https://github.com/gorilla/websocket), [pion/webrtc](https://github.com/pion/webrtc), and [adriancable/webtransport-go](https://github.com/adriancable/webtransport-go)\n- 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](https://getbootstrap.com/) and [Chart.js](https://www.chartjs.org/) were used.\n\n## Local testing\n\n1. Clone repo\n    ```bash\n    git clone https://github.com/Sh3B0/realtime-web.git\n    cd realtime-web\n    ```\n\n2. Create locally trusted certs using [mkcert](https://github.com/FiloSottile/mkcert) \n    ```bash\n    mkdir certs \u0026\u0026 cd certs\n    mkcert -install\n    mkcert localhost\n    ```\n\n3. Run a server (use similar commands for `webtransport` and `webrtc`)\n    ```bash\n    ./run.sh websocket\n    ```\n\n4. Simulating packet loss (use `del` instead of `add` to remove rules)\n    ```bash\n    sudo tc qdisc add dev lo root netem loss 15%\n    ```\n    \n5. Run client\n    ```bash\n    ./run.sh client\n    chromium --origin-to-force-quic-on=localhost:8001 http://localhost:3000\n    ```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSh3b0%2Frealtime-web","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSh3b0%2Frealtime-web","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSh3b0%2Frealtime-web/lists"}