WebTransport
WebTransport is a new transport protocol that allows for low-latency, bidirectional, and multiplexed communication between a client and a server. The protocol is built on top of HTTP/3 and QUIC, which in turn is built on UDP instead of TCP.
Experimental - This WebTransport implementation hasn’t been battle tested. Please report any issues you may find - WebTransport is still an emerging technology and not widely available yet.
The underlying library is @fails-components/webtransport - a backend implementation of HTTP3/WebTransport.
Unreliable delivery
WebTransport is the only Colyseus transport with a real unreliable channel: QUIC datagrams, delivered at most once and never retransmitted. Two features depend on it, and both are experimental alongside it:
.unreliable()schema fields: a value replaced every tick ships on the datagram channel. A dropped packet then costs nothing, instead of stalling the ordered stream behind a retransmit.- Unreliable input:
room.input({ mode: "unreliable" }), where each packet carries the last few inputs as redundancy against drops.
Every WebSocket transport lacks that channel. .unreliable() fields then stop updating after the full state sync, with a warning logged once. Unreliable input falls back to the reliable channel, its redundancy wasted. Client-side WebTransport support is currently limited to the JavaScript/TypeScript SDK.
npm install --save @colyseus/h3-transportUsage
import express from "express";
import { defineServer } from "colyseus";
import { H3Transport } from "@colyseus/h3-transport"
const app = express();
app.get("/hello", (req, res) => {
res.json({ hello: "world!" });
});
const server = defineServer({
// ...
transport: new H3Transport({
app, // required: H3Transport serves HTTP through this Express app
/* other H3Transport options */
}),
// ...
});Pass your Express app via the transport’s app option. The defineServer({ express }) callback is not supported by H3Transport: it is silently ignored.
Available options
app: (required) The Express app served over HTTP/3.cert: Certificate contents (cert.pem)key: Private key contents (key.pem)secret: (?)server: Thehttp.Serverinstance to be used.localProxy: (optional) Fallback every URL through the this local proxy.
beforeUpgrade, available on the WebSocket transports, is not supported here.
WebTransport sessions arrive already established, so there is no upgrade
handshake to intercept. H3Transport warns and ignores the option.