True send queue
Stack queue, in-flight bytes, cwnd, srtt and min RTT come straight from the SCTP association. No hidden buffer.
WebRTC data channels for io games, with a Rust core and a Node.js API. Ping stays near the real round trip when the connection drops packets.
Ping p50 at 200 ms RTT and 5% loss, server to client (client to server is the browser's own SCTP). Full setup
pnpm add lagless
Stack queue, in-flight bytes, cwnd, srtt and min RTT come straight from the SCTP association. No hidden buffer.
Unreliable send() returns false when it wasn't queued. Keep the state owed and send fresher state next tick.
RFC 8985 loss recovery patched into rtc-sctp, so a lost packet doesn't wait for a 1 s retransmission timeout.
A delay-based budget keeps the network queue near zero. Reliable goes first, unreliable fills the rest.
Probe messages skip the drop gate, so ping measures the real queue instead of hiding it.
A napi-rs binding over the webrtc-rs rtc sans-IO core, with a typed TypeScript API on top.
send() tells you when unreliable state wasn't queued. Keep it owed, and next tick send the newest version instead of piling up old snapshots behind a lost packet.
// every tick, per player
server.send(peer, "reliable", events);
for (const snap of snapshots) {
if (!server.send(peer, "state", snap)) break;
// dropped: send fresher state next tick
}