WritePad
What did I actually build
The industry standard for real-time apps (Google Docs, Figma) relies on WebSockets, technology from 2011. The flaw? It treats every packet as critical. If a cheap 'mouse move' packet drops, the entire connection waits for it to be re-sent, freezing your screen. I built WritePad to fix this. It is powered by yjs-webtransport, a novel protocol I designed that uses QUIC to respect the physics of data. It creates a 'Hybrid Highway,' allowing critical text updates to flow reliably while cursor movements fly through a separate, loss-tolerant lane.
Tech Stack
The Engine: yjs-webtransport
This is the novel core of the project. It is the first known implementation of Y.js over QUIC Datagrams.
Most providers (y-websocket) use a single TCP lane. yjs-webtransport opens two distinct lanes over one HTTP/3 connection:
- The Reliable Lane (QUIC Streams): For document edits. Guaranteed order. Zero data loss.
- The Fast Lane (QUIC Datagrams): For cursors and presence. "Fire and forget." If a packet drops, the stream never stops.
The Problem Solved: Head-of-Line Blocking
The Old Way (WebSockets/TCP)
Imagine a single-lane tunnel. If a car (packet) breaks down, all traffic behind it stops.
Result: You type, but nothing appears for 200ms because someone else's cursor packet got lost.
The WritePad Way (QUIC)
We introduced Independence.
- If a cursor packet drops in the "Fast Lane," the "Reliable Lane" doesn't care. It keeps moving.
- Result: Zero blocking. Text always syncs instantly, even on bad WiFi.
Engineering Benchmarks
I tested this on a real-world high-latency path (India Client → Oracle Cloud Server).
| Metric | WritePad (QUIC) | Significance |
|---|---|---|
| P50 Latency | 17.7ms | Near-instant sync feel. |
| Delivery Rate | 99.8% | Even with unreliable datagrams, it is incredibly robust. |
| Bandwidth | -82% | Custom Binary Protocol vs. Standard JSON. |
| Packet Loss | Resilient | The document never freezes, even if the network hiccups. |
Novelty Check: Before building, we audited existing solutions (y-websocket, y-partykit). None of them utilize QUIC Datagrams for hybrid sync. This is a first-of-its-kind implementation.
Key Concepts & Terminology
| Term | In Plain English | Why it's a Game Changer |
|---|---|---|
| QUIC Datagrams | Sending data like a postcard, not a registered letter. | Perfect for high-frequency data (60fps cursors). Removes overhead. |
| Hybrid Protocol | Using the right tool for the right job. | We get the safety of TCP and the speed of UDP in one connection. |
| Binary Framing | We send raw bytes (0x01), not text ("type": "sync"). | Reduces payload size from ~150 bytes to ~15 bytes per update. |
| 0-RTT Resume | Reconnecting without the handshake. | If you close your laptop and open it, sync resumes instantly. |
🔗 Repository: github.com/kartikgupta/WritePad