Skip to content

DurableWS

The WebSocket client that survives the real world — automatic reconnection, bounded queueing, and typed messages. Zero dependencies, every modern runtime.

Durable by default

Automatic reconnection with full-jitter backoff and bounded message queueing — on out of the box. Opt-in heartbeat closes quietly-dead links. Every dropped message is observable; nothing is silently lost.

Typed end to end

Pass any Standard Schema (zod, valibot, arktype, …) and inbound messages are inferred and runtime-validated before your handlers see them.

Vue & React in the box

A composable and a hook as subpath exports with optional peers — reactive connection state, automatic cleanup, one install.

Drop-in compatible

durablews/compat is a WebSocket-shaped class: swap it into existing code or inject it as a library’s webSocketImpl — with a published known-deviations table.

Zero dependencies

Built on the standard global WebSocket. No ws, no bloat. Browsers, Node ≥22, Deno, Bun, and the edge.

Extensible where it counts

Middleware in both directions (async-safe, auth-ready) and a pluggable codec for custom wire formats.