Multiplayer networking for browser games. Reliable, ordered events for actions that must arrive. Fresh, replaceable state for movement and snapshots. One player session survives dropped connections, app switches and Wi-Fi hand-offs. Your server owns the game; Twinwire keeps the session.
WebSocket carries the session and reliable events. State can use WebRTC or optional WebTransport over HTTP/3, with WebSocket fallback. WebTransport requires a configured HTTP/3 host and browser support; every datagram path must prove itself.
States ride the WebSocket until the datagram path proves itself both ways.
Interactive simulation. Two Twinwire endpoints run locally in this page, exchanging real frames over a simulated network, slowed down so you can watch. Block UDP, and within 1.5 seconds of game time everything is on the WebSocket, without the session noticing.
The same player can outlive a socket. Click Drop the connection and watch it resume automatically. The session ID and lobby seat stay the same within the grace period; unacknowledged events replay once. This runs Twinwire's session code in a local simulation. What the demo does · All seven interactive lessons
OnlineConnection attemptAttempt failedSeat in useSeat held for the player
Client idleSession noneConnection epoch 0Resumed 0 timesEvents waiting to be acknowledged 0
The modes describe how messages behave. The transport is the path carrying them.
Delivery mode
What it does
Where it travels
Reliable events
Delivers actions in order, acknowledges them and replays unacknowledged events after reconnecting
WebSocket, with copies racing on the selected proven datagram path
Replaceable state
Sends the latest movement or world snapshot, coalescing and expiring older updates
Proven WebRTC or WebTransport datagrams, with WebSocket fallback
WebTransport support is optional and available in 3.0. It adds an HTTP/3 QUIC datagram path alongside WebRTC. Configure a compatible Node host with a trusted TLS certificate and UDP routing. Each connection needs browser support and two-way probe replies before Twinwire selects that path. Browsers without it continue with WebRTC or WebSocket; the Worker host and live starter use WebSocket.
The client still establishes its session over WebSocket. A transport change keeps the same logical player. Path selection uses measured probe RTT, payload limits and a hold time; performance depends on the workload and network. Set up WebTransport · Understand path selection
Play the live arena in two tabs using the same invite URL. Move, send a reliable ping, and disconnect for two seconds. This is a real hosted WebSocket game, with a separate private arena per invite. The downloadable Node version also supports native WebRTC.
Open http://127.0.0.1:8787 in two tabs. Move your player, send a reliable ping, disconnect for two seconds, and reload the page. Your ID and score survive the interruption. The starter uses the published package and serves its own browser module; no bundler or account is needed.
Already have a game? Port an existing transport, keep your current simulation, and deploy the client and server together. For rooms, ready-up, prediction and chat, start from the party example.
Twinwire is a library, under the MIT license. You host a Node server or a compatible Worker, plus your client, choose your physics and serialization, and validate player actions. It does not supply a database, an account system, or a global room allocator. A WebSocket is enough to start; native WebRTC is optional.