Repository navigation
Transports and Wisp
STomp rewrites pages, but it does not fetch them itself. Every byte a proxied page sends or receives goes through a transport: a JavaScript module (with WebAssembly inside) that speaks TLS, HTTP and WebSockets in the browser and tunnels the raw TCP and UDP connections to a wisp relay over one WebSocket or WebTransport session. This page explains how that path works, which transport to pick, how to serve it, and how to run the relay.
If you only want something working, follow Install into an existing app first and come back here when you need to change the transport or host your own relay.
proxied frame
-> service worker (/stomp/serviceWorker.js: routes, rewrites, caches)
-> transport worker (/stomp/transportWorker.js, started by the controller)
-> transport (epoxy or libcurl: TLS, HTTP/1.1, HTTP/2, HTTP/3, WebSocket)
-> wisp connection (one WebSocket or WebTransport session to the relay)
-> wisp relay (holyWisp or wisp-js: opens TCP and UDP sockets)
-> the real site
- A page in a frame created by
controller.createFrame()asks for a URL. Its address is a routed URL under yourdirectory(/stomp/<id>/...), so the STomp service worker receives the request. - The service worker turns the routed URL back into the real one, rebuilds cookies,
OriginandReferer, and answers from its HTTP cache when it can. - Anything that needs the network goes to the transport over a
MessagePortthe controller handed the service worker. With a transport descriptor (below) the transport lives in a dedicated worker,transportWorker.jsfrom yourdirectory, so neither the host page's thread nor the service worker's does TLS. - The transport opens a wisp stream for each TCP connection (or UDP flow) and runs TLS and HTTP over it inside the browser. For an
https:site the relay sees the host, the port and encrypted bytes, nothing more. - The relay opens a real socket to the site and copies bytes both ways.
- The response comes back the same way; the service worker rewrites HTML, CSS and JavaScript and hands it to the frame.
WebSockets never pass through a service worker. A proxied page's WebSocket is a stand-in that reaches the same transport over its own port and calls the transport's connect(). WebRTC and the page's own WebTransport sessions ride wisp UDP streams the same way (see WebRTC and WebTransport).
The controller, the page that created StompController, owns all of this. If the host tab closes, the transport goes with it.
STomp accepts any proxy-transports ProxyTransport. Two are tested:
| epoxy (pinned build) | libcurl | |
|---|---|---|
| Package |
@mercuryworkshop/epoxy-transport from github:Fracital/EpoxyTransport#<sha>
|
@mercuryworkshop/libcurl-transport 2.0.6 (libcurl.js 0.7.5) |
| HTTP/1.1 and HTTP/2 | yes, Chrome's TLS and HTTP/2 fingerprint | yes, libcurl's own fingerprint |
HTTP/3 (http3) |
yes | no (no UDP API) |
Wisp over WebTransport (webTransport) |
yes | no, always the WebSocket |
| Proxied pages' WebRTC and WebTransport | yes | no |
Encrypted Client Hello (ech_dns) |
yes | no |
TLS on several threads (shards) |
yes | no |
| Files to serve |
dist/ (index.mjs, epoxy.wasm, h3/) |
dist/index.mjs (about 2 MB, self-contained) |
Use the pinned epoxy build. It is what the demo at https://stomp.fracit.al browses with, and the only transport that HTTP/3, WebTransport, WebRTC and shards work with.
Keep libcurl for one job: telling a transport bug from a STomp bug. When a site misbehaves, switch the controller to libcurl with setTransport() and load it again. If it works there, the problem is in epoxy or the relay path; if it fails the same way, it is in STomp. The changelog lists libcurl's known limits: its HTTP connection pool has stalled after roughly 70 requests with the default pool and 160 with a larger one, it answers no WebSocket ping, and a close the server starts reaches the page as 1005. The demo raises its pool with connections: [500, 400, 200]; do the same:
{ module: '/libcurl/index.mjs', options: [{ wisp, connections: [500, 400, 200] }] }Older notes in the README say epoxy's incoming WebSocket frames stop after the first round trip. That was the npm release of epoxy. The pinned build carries WebSockets both ways (an echo test of two round trips passes through holyWisp, wisp-js and the public relay).
Do not install @mercuryworkshop/epoxy-transport from the npm registry. STomp pins a patched build of epoxy and tests against it. The patches live in deploy/epoxy/patches/ on top of the upstream revisions named in deploy/epoxy/upstream.env, and deploy/epoxy/README.md lists each one. What they fix, in the order you are likely to hit it:
- Responses with more than 16 KiB of headers were reset with
PROTOCOL_ERROR. YouTube sends 12 to 20 KB. The build allows 256 KiB, as Chrome does. - Two requests started in the same tick on a cold transport lost one of them: two frames navigating at once, and the first never loaded.
- A pooled connection the server had closed for idling hung the next request on it.
- A request body went out as one wisp packet. holyWisp closes the whole wisp connection (code 1009) on a message over 262149 bytes, so one large upload killed every tab. The build writes packets of at most 64 KiB within the relay's CONTINUE credit.
- A
206 Partial Contentresponse withContent-Encodingwas decoded as if whole, which truncated fonts and media. - The WebSocket handshake differed from Chrome's (an absolute URL in the request line, which Akamai answers with 400; a lost port in
Host; twoUser-Agentfields), and a close the server started always read 1000. - Malformed HTTP/1 headers that Chrome reads made the whole response fail.
- TLS, HTTP/2 and HTTP/1 fingerprints now match Chrome's, real ECH is available through
ech_dns, and connections are pooled per top-level site as Chrome pools them. - The build carries stomp-h3 in
dist/h3/: the QUIC and HTTP/3 client behindhttp3, the page's own WebTransport sessions and the WebRTC stack's UDP.
The build is the dist branch of Fracital/EpoxyTransport, so installing it needs no Rust toolchain. Install the commit STomp's own package.json pins (master pins 4d5a277e0e7691e572633d829c17619c2ef647b3 as of this writing; check devDependencies in package.json for the current one, and move it when you move @sysce/stomp):
npm install --save-exact @sysce/stomp@nightly
npm install "@mercuryworkshop/epoxy-transport@github:Fracital/EpoxyTransport#4d5a277e0e7691e572633d829c17619c2ef647b3"The package reports version 3.0.2-fracital.1. Its license is AGPL-3.0-only.
Serve the package's whole dist/ directory; index.mjs alone does not start. The module loads epoxy.wasm from next to itself, and STomp loads h3/stomp_h3.js from next to the module for HTTP/3, WebTransport and WebRTC.
import { createRequire } from 'node:module';
import { dirname } from 'node:path';
import express from 'express';
import { stompPath } from '@sysce/stomp/path';
const require = createRequire(import.meta.url);
const dist = (name) => dirname(require.resolve(`@mercuryworkshop/${name}`));
const app = express();
app.use('/stomp/', express.static(stompPath));
app.use('/epoxy/', express.static(dist('epoxy-transport')));
app.use('/libcurl/', express.static(dist('libcurl-transport')));require.resolve() returns dist/index.js for both packages, so its directory is the dist/ to serve. The descriptor's module is then /epoxy/index.mjs, and stomp-h3 is found at /epoxy/h3/stomp_h3.js. If you put stomp-h3 somewhere else, name it with http3: { module }.
For long caching, the demo serves the same files under a hash of their contents too (/epoxy/<16 hex>/index.mjs, immutable), and plain /epoxy/ as no-cache. Use a path segment, not a query string: the module's relative URLs (epoxy.wasm, h3/...) keep the directory but drop the query, so a query would let a new module meet an old cached wasm. See demo/server.js (filesHash, transportFiles).
deploy/epoxy/build.sh builds the same thing from the pinned upstream revisions and the patches, in a Docker or Podman container (10 to 20 minutes). It writes deploy/epoxy/out/epoxy-transport/, which you can point the package at and test with npm test before publishing. ENGINE names the container engine, or a wrapper around it (for example one that adds --network host to docker build where the default bridge has no internet). A patch that no longer applies fails the build.
init.transport takes either a descriptor (the module's URL and its constructor arguments) or an instance you constructed. Use a descriptor.
import { StompController } from '/stomp/controller.mjs';
const wisp = `${location.origin.replace(/^http/, 'ws')}/wisp/`;
const registration = await StompController.register('/stomp/');
const controller = new StompController({
serviceworker: registration,
directory: '/stomp/',
codec: 'xor',
transport: {
module: '/epoxy/index.mjs',
options: [{ wisp }],
http3: true,
webTransport: true,
},
});
await controller.wait();A descriptor (TransportDescriptor, src/controller/messages.ts) has these fields:
| Field | Default | What it does |
|---|---|---|
module |
required | URL of an ES module whose default export is a ProxyTransport class. Resolved against the host page. With RemoteController it must be on the proxy origin, or the controller frame throws "Transport modules must live on the proxy origin". |
options |
[] |
Constructor arguments, passed as new Transport(...options). Both transports take { wisp } first. On a worker host they cross into the worker, so they must survive structuredClone (no functions). |
host |
'worker' |
'worker' runs the transport in transportWorker.js; 'page' imports it in the host page. See Worker or page. |
http3 |
off |
true or { force, dns, timeout, wait, module, pem }. See HTTP/3. |
webTransport |
off |
true or { url, discovery, timeoutMs, lanes }: the wisp connection rides a WebTransport session to the relay when it can. See WebTransport. |
shards |
up to 4 extra workers | A number, or { max, start }. See Shards. |
Epoxy's own options go in options[0] next to wisp. The one the demo sets is ech_dns: 'https://cloudflare-dns.com/dns-query', a DNS-over-HTTPS endpoint epoxy asks for each site's HTTPS record, so connections to sites that publish an ECH config use real Encrypted Client Hello as Chrome does. Without it every connection sends a GREASE ECH. The full list is EpoxyOptions in the package's dist/index.d.ts.
You can still pass an instance, as older examples do:
import EpoxyTransport from '/epoxy/index.mjs';
new StompController({ serviceworker: registration, transport: new EpoxyTransport({ wisp }) });The controller then serves that object from the host page. You lose:
- Synchronous XHR. A proxied page's
XMLHttpRequestwithasync: falseblocks its thread until the answer comes. In same-origin mode that is the host page's thread too, so a transport on it can never answer: the request fails with status 0 after 30 s. In a worker it completes. - The descriptor fields:
http3,webTransportandshardsexist only on descriptors, andcontroller.carrierstaysnull. -
RemoteController. It only takes descriptors, because the transport has to be built on the proxy origin inside the controller frame.
An instance is fine for a quick test or for a transport you need to wrap in code. Everything else should use a descriptor.
controller.transportHost says where the transport runs: 'worker' or 'page'.
A descriptor runs in the worker unless it says host: 'page'. If the worker cannot start, or cannot import the module, the controller logs "the transport worker could not host the transport, hosting it in the page", imports the module in the page instead and dispatches a transporthost event:
controller.addEventListener('transporthost', (event) => {
// event.detail: { host: 'page', error }
console.warn('transport fell back to the page', event.detail.error);
});If the page cannot import it either, the controller holds a transport that fails every request at once (the error page says why) until you call setTransport().
The worker is a classic Worker, not a module worker, because libcurl's emscripten build misdetects its environment in a module worker. Your module is loaded into it with dynamic import(), so it must be an ES module that runs in a worker (no document, no window). Epoxy and libcurl both do.
Pick host: 'page' only for a transport that needs the page (one that touches the DOM, say). It brings back the synchronous XHR deadlock described above.
controller.transport is always something you can call from the console, wherever the transport runs: for a worker it is a RemoteTransport over a port the worker serves. Call await controller.transport.init() once if you probe it by hand.
setTransport() replaces the transport without a new controller. Requests in flight finish on the old one; new ones go to the new one. It resolves once the new transport is in place.
// transportHost 'worker': pass a descriptor
await controller.setTransport({
module: '/libcurl/index.mjs',
options: [{ wisp, connections: [500, 400, 200] }],
});The argument has to match transportHost. A worker-hosted controller takes a descriptor; a page-hosted one (an instance, host: 'page', or after a fallback) takes an instance. The other kind throws a TypeError that says which it wanted. RemoteController.setTransport() takes descriptors only.
The demo's transport menu is exactly this call (demo/public/pm/main.js, transports and setTransport).
controller.carrier and the carrier event say what the wisp connection rides, each time a descriptor's transport (given a wisp URL) connects or reconnects:
controller.addEventListener('carrier', (event) => {
const { carrier, url, ms, why, lanes, transport, http3 } = event.detail;
// carrier: 'webtransport' or 'websocket'; why: the reason it is not WebTransport ('off' without webTransport)
});The other fields are previous (the carrier the last transport to this relay used, when it differed), reconnected, shared (how long the shared carrier had been up when this transport took it) and serverStream. No proxied page is told any of this.
The console always gets a [wisp] line for each carrier event. debugTransport: true in the controller init, or localStorage['stomp:debug-transport'] = '1' on the host's origin and a reload, adds a [net] line for each connection to a site. A run against holyWisp printed:
[wisp] connecting to ws://127.0.0.1:8095/wisp/ (wisp transport WebSocket (TCP), WebTransport off; epoxy, HTTP/3 on)
[net] HTTP/2 to https://example.com: TLS over a Wisp TCP stream, on the WebSocket (TCP); partition https://example.com same-site
[net] HTTP/3 to https://example.com (partition https://example.com same-site): QUIC over a Wisp UDP stream to example.com:443, on the WebSocket (TCP); handshake 69 ms, from Alt-Svc
[net] WebSocket to wss://ws.postman-echo.com/raw: HTTP/1.1 Upgrade over TLS over a Wisp TCP stream, on the WebSocket (TCP)
Both work on RemoteController too, which prints the controller frame's notes on the host's console.
By default a transport given a wisp URL does not open its own connection to the relay. It rides the carrier host, a SharedWorker started from transportWorker.js that keeps one WebSocket or WebTransport session per relay for your whole origin, so a reload or a second tab reuses it instead of dialing again. carrierHost: false in the StompController init gives each transport its own connection. RemoteController has no such option; it always shares.
TLS and HTTP/2 framing cost CPU, and one transport worker is one thread. With shards, the transport worker starts more copies of the transport in workers of its own when it cannot keep up with downloads from more servers than it has threads. Each origin's connections run on one shard, every shard rides the same wisp connection, and a shard that carried nothing for 30 s closes. The socket pool, the request order and the header fields stay the transport worker's, so a site sees one browser.
| Value | Meaning |
|---|---|
| unset | at most 1 + min(4, floor(navigator.hardwareConcurrency / 2)) threads, the transport worker's counted; only the transport worker at start |
1 |
the transport worker alone |
n |
at most n threads (clamped to 1..16) |
{ max, start } |
at most max, and start of them running from the beginning |
Shards need host: 'worker', a wisp URL in options[0], options that survive structuredClone, and a transport that reports each response's HTTP version, which only the pinned epoxy build does. Anything else runs alone without complaint. The [net] lines say which shard took an origin (runs on transport shard 1 of 5).
Chrome talks HTTP/3 (QUIC over UDP) to sites that advertise it, and some sites treat sessions differently depending on which one they got. With http3 on, a request to an origin that has advertised h3 travels as QUIC datagrams over a wisp UDP stream; everything else stays on the transport's TCP connections. The full design is docs/http3.md.
transport: {
module: '/epoxy/index.mjs',
options: [{ wisp }],
http3: true,
}| Option | Default | What it does |
|---|---|---|
force |
none | origins (https://host[:port] or host:port) to use h3 on without an Alt-Svc first, like Chrome's --origin-to-force-quic-on
|
dns |
off | a DNS-over-HTTPS endpoint asked for HTTPS records, so h3 can be used before the first Alt-Svc
|
timeout |
10000 | ms a QUIC handshake may take before the origin is marked broken |
wait |
300 | ms a request waits for a reconnect to an origin QUIC already worked for |
module |
h3/stomp_h3.js next to module
|
where stomp-h3 is |
pem |
none | extra trusted root certificates for QUIC (tests) |
It needs epoxy (libcurl has no UDP; the option does nothing there) and a relay that relays UDP. Until a handshake to an origin has worked, its requests go over TCP as before, and a failed one falls back at once. A relay that refuses UDP costs nothing: each refused stream fails at once, and after eight refused hosts QUIC is off for 5 minutes at a time. The stomp-h3 wasm (about 1.1 MB gzipped) is only fetched once an origin advertises h3. Bulk downloads over h3 cost more CPU than over HTTP/2, because every 1.2 KB datagram is its own wisp frame.
The demo turns it on by default (STOMP_HTTP3=0 on the server turns it off, ?http3=0 on the page for one visit).
Two separate features share the name. docs/webtransport.md covers both.
webTransport on the descriptor lets the transport's own wisp connection ride a WebTransport (QUIC) session to the relay instead of a WebSocket. That gives HTTP/3 and WebRTC real datagrams end to end, and spreads streams over several QUIC streams ("lanes") so one lost packet holds up only its own lane. The WebSocket stays as the fallback.
| Option | Default | What it does |
|---|---|---|
url |
derived | the session's https: URL, its certificate checked like any site's |
discovery |
/webtransport.json on the wisp URL's origin |
a discovery document URL, resolved against the wisp URL |
timeoutMs |
2000 | how long the document, the handshake and the wisp stream may each take; a first start with a relay it has not met may take half as long again |
lanes |
the relay's number | the most QUIC streams to use, lane 0 counted; 1 for one |
With neither url nor discovery, a wss: wisp URL is dialed as https: on the same host and path, and /webtransport.json on its origin is asked only when that fails. A ws: URL goes to the document first. The document is JSON:
{ "url": "https://127.0.0.1:41919/", "hashes": [{ "algorithm": "sha-256", "value": "<base64>" }] }hashes pins a self-signed certificate (Chrome's serverCertificateHashes: ECDSA, valid 14 days at most, which holyWisp's rotating P-256 certificate meets). A relay whose certificate a public CA issued needs no document at all: its wss: URL is dialed as https:, or you name the session with webTransport: { url }. The document must come over HTTPS, or plain HTTP on loopback, and needs Access-Control-Allow-Origin when it is on another origin than your page.
What happens on a slow or blocked network: a relay the browser has not met before gets the session and the WebSocket opened together, and the transport rides whichever is up in time. The result is remembered for 7 days. When the session fails, the console says WebTransport unavailable (<why>) and the transport stays on the WebSocket for 30 s before it tries again. So a network that drops UDP costs one timeout per relay, not one per page load.
Requirements: a secure-context host page (HTTPS, or localhost/127.0.0.1), epoxy, and a relay with a WebTransport listener whose UDP port the browser can reach. holyWisp has one from 0.5.4-nightly; the 0.5.3 release ignores the option without a word. The public relay has one. wisp-js does not.
A proxied page never gets the browser's real WebTransport, because a native session would leave from the user's own address. It gets a stand-in whose sessions run as QUIC over a wisp UDP stream through stomp-h3. This is always on and has no switch. It needs epoxy and a relay with UDP; with libcurl or a relay without UDP every session fails with "Opening handshake failed." Sessions are checked by the content blocker like WebSockets.
Proxied pages get a working RTCPeerConnection: data channels, audio and video, STUN, TURN over UDP, TCP and TLS. STomp runs its own WebRTC stack (a str0m build in rtc.wasm, run by rtcWorker.js and rtcStack.js) and sends every packet over wisp streams, so peers and STUN servers see the relay's address and never the user's, their LAN addresses or mDNS names. It is on by default, there is no option, and nothing loads until a page creates a connection. Serve all of dist/ and it is there; init.assets can rename the three files.
Like HTTP/3 it needs epoxy and a relay that relays UDP. With UDP refused, only TURN over TCP or TLS servers in the page's iceServers can connect. With libcurl a connection gathers its host candidate and never connects. To the outside the page sits behind the relay as behind a symmetric NAT, so two peers that are both behind strict NATs need the page's TURN server, as they would natively. Details: docs/webrtc.md (what Chrome exposes and what STomp matches) and docs/webrtc-over-wisp.md (the stack's design).
holyWisp is a Wisp v1/v2 server written in C. It runs the public relay and the demo's built-in /wisp/. The holywisp npm package carries prebuilt binaries for Linux, macOS and Windows (x64 and arm64; deploy on Linux, the others are for development) and a wrapper that starts the binary as a child process and hands it your HTTP server's WebSocket upgrades. No install script, Node 20 or newer.
npm install --save-exact holywisp@0.5.3STomp's master pins 0.5.3. holywisp@nightly has the WebTransport listener; pin the exact nightly version you tested.
import { createServer } from 'node:http';
import express from 'express';
import { holyWisp } from 'holywisp';
const wisp = new holyWisp({
port: 0, // any free port on 127.0.0.1; route() below is the way in
allowUDP: true, // the default, written out: HTTP/3, WebRTC and WebTransport need it
floodProtection: { enabled: false },
maxMessageSize: 262149,
logLevel: 'warn',
});
await wisp.start(1); // worker threads; 0 = one per CPU
const app = express();
// ...serve /stomp/, /epoxy/ and your pages here...
const server = createServer(app);
server.on('upgrade', (req, socket, head) => {
if (req.url.startsWith('/wisp/')) wisp.route(req, socket, head);
else socket.destroy();
});
server.listen(8080);The page's wisp URL is then ws://localhost:8080/wisp/ (wss: behind HTTPS). The wrapper stops the server when Node exits, and restarts it when it crashes (autoRestart, on by default; route() answers 503 in the gap). It tells the server the real client address of each upgrade, so per-client limits apply to clients and not to your Node process. If your Node server sits behind nginx or another reverse proxy, list it in trustedProxies; only then are its X-Forwarded-For headers believed. Don't listen on a Unix socket: route() refuses upgrades with no peer address (403).
| Option | Flag | Default | Notes |
|---|---|---|---|
host |
host |
127.0.0.1 |
The wrapper never binds every interface unless you say 0.0.0.0. |
port |
port |
6001 |
0 takes any free port; a taken one moves to the next. |
allowUDP |
allow-udp |
on | HTTP/3, WebRTC and both WebTransport features need it. |
allowDirectIP |
allow-direct-ip |
off | Lets pages connect to literal IP addresses. The demo turns it on. |
allowPrivateIPs, allowLoopbackIPs, allowLinkLocalIPs
|
allow-private, allow-loopback, allow-link-local
|
off | Opens your machine and network to every client. Only for local test fixtures. |
allowedOrigins |
allow-origin |
any page | Origins (https://example.com) whose pages may connect. Set it to your site's origin unless you mean to run a public relay. |
floodProtection |
flood-protection and others |
on | Its per-destination limit (100 connects a second to one ip:port) closes streams of a page that bursts to its own host. The demo and the public edges turn it off. |
maxMessageSize |
max-message-size |
server's | Larger messages close the connection with 1009. The edges use 262149; the pinned epoxy build keeps under it. |
streamQueueMax |
stream-queue-max |
128 MiB | Bytes queued toward a site per stream. |
connectionsLimitPerIP, bandwidthLimitKbps
|
connections-limit-per-ip, bandwidth-limit-kbps
|
200 per 10 s, off | Per-client limits. |
passwordUsers, passwordAuthRequired
|
password-user, password-required
|
none | Wisp v2 password auth. Neither transport has an option to send credentials, so leave it off for STomp. |
webTransport |
webtransport |
off | nightly only. true, or { host, port, url, certFile, keyFile, ... }. |
logLevel |
log-level |
warn |
debug logs every stream. |
The full list is in the package README and holywisp --help.
npm run demo starts holyWisp from node_modules with the settings the production edges use (demo/server.js):
new holyWisp({
port: 0,
allowDirectIP: true,
allowLoopbackIPs: !!process.env.WISP_ALLOW_LOOPBACK,
allowPrivateIPs: !!process.env.WISP_ALLOW_LOOPBACK,
allowUDP: !process.env.WISP_NO_UDP,
floodProtection: { enabled: false },
maxMessageSize: 262149,
streamQueueMax: 64 * 1024 * 1024,
dnsResultOrder: 'ipv4first',
tcpNoDelay: true,
logLevel: process.env.HOLYWISP_LOG_LEVEL || 'error',
webTransport: true, // unless STOMP_WISP_WEBTRANSPORT=0
});| Variable | Effect |
|---|---|
STOMP_WISP_URL |
use this relay instead; no holyWisp is started and /wisp/ is not served |
WISP_ALLOW_LOOPBACK |
let the built-in relay reach loopback and private addresses (test fixtures, npm run dev) |
WISP_NO_UDP |
refuse UDP streams, to test the fallbacks |
WISP_BLOCK_HOSTS |
comma-separated host names the built-in relay refuses |
HOLYWISP_LOG_LEVEL |
the relay's log level (default error) |
HOLYWISP_BIN |
run this holywisp binary instead of the package's |
STOMP_HTTP3 |
0 leaves http3 off the epoxy descriptor |
STOMP_WISP_WEBTRANSPORT |
0 turns webTransport off; a URL names the session, a URL ending in .json names the discovery document |
The demo only tells the page to try WebTransport when holyWisp answers /webtransport.json with hashes, and it forwards that document on its own origin with url filled in as https://127.0.0.1:<holyWisp port>/. With master's pinned holywisp@0.5.3 there is no listener, so a local demo rides the WebSocket.
With a nightly that has the listener:
const wisp = new holyWisp({ port: 0, webTransport: true });
await wisp.start(1);
// the transport looks for the document on the wisp URL's origin: forward it
app.get('/webtransport.json', async (req, res) => {
const body = await fetch(`http://127.0.0.1:${wisp.port}/webtransport.json`).then((r) => r.json());
res.set('Cache-Control', 'no-store');
res.json({ ...body, url: body.url || `https://127.0.0.1:${wisp.port}/` });
});Browsers connect to the WebTransport listener directly over UDP, not through route(). It binds the wrapper's host (127.0.0.1) and the server's TCP port number unless webTransport.host and webTransport.port say otherwise. For a public deployment, bind an address browsers can reach, open that UDP port, and either give it a real certificate (certFile, keyFile, ECDSA P-256) or keep the rotating self-signed one and serve the document. If the relay's host name goes through a TCP-only proxy (Cloudflare's, say), the UDP never arrives: set webTransport.url (webtransport-url) to a name that reaches the server directly.
The binary works without Node. Every flag is also a key = value line in a config file:
# holywisp.conf
host = 127.0.0.1
port = 6101
workers = 0
allow-udp = on
max-message-size = 262149
log-level = infonode_modules/holywisp/bin/linux-x64/holywisp --config holywisp.confThe wisp URL is then ws://127.0.0.1:6101/ (any path). Run alone, it has flood protection and reputation scoring on, as its log line says (listening on 127.0.0.1:6101 with 32 workers, flood protection on, reputation on); add flood-protection = off for the reason above. Behind nginx or Caddy, proxy the WebSocket upgrade to it and list the proxy with trusted-proxy; Deploy STomp has the proxy configs.
wisp-js (@mercuryworkshop/wisp-js) is MercuryWorkshop's Wisp server in JavaScript. It runs inside your Node process, relays TCP and UDP, and works with both transports and HTTP/3. It has no WebTransport listener, so webTransport falls back to the WebSocket.
Use 0.5.3 or later. wisp-js 0.5.2 and older never refill a TCP stream's credit, so an epoxy stream stalls after its first 128 packets: an upload over 8 MiB, or a long-lived connection's 128th write.
npm install --save-exact @mercuryworkshop/wisp-js@0.5.3import { server as wisp, logging } from '@mercuryworkshop/wisp-js/server';
logging.set_level(logging.WARN);
wisp.options.allow_udp_streams = true; // the default
server.on('upgrade', (req, socket, head) => {
if (req.url.startsWith('/wisp/')) wisp.routeRequest(req, socket, head);
else socket.destroy();
});Its options (allow_loopback_ips, allow_private_ips, hostname_blacklist, port_whitelist, dns_result_order and the rest) are set on wisp.options and listed in its README. They apply to the whole process.
wss://holywisp.fracit.al/ is a public holyWisp relay run by Fracital, the one https://stomp.fracit.al uses. It relays UDP, has a WebTransport listener at https://holywisp.fracit.al/ with a public certificate (8 lanes), accepts pages from any origin and refuses private, loopback and link-local destinations.
transport: {
module: '/epoxy/index.mjs',
options: [{ wisp: 'wss://holywisp.fracit.al/' }],
http3: true,
webTransport: true,
}It is the quickest way to try STomp without running a relay, and a fair baseline when you wonder whether your own relay is the problem. Everyone who uses it shares it, and every site your users visit sees its addresses. For a site with real traffic, run your own.
| Symptom | Likely cause | Fix |
|---|---|---|
| Every page is STomp's error page right after start | The transport module failed to load in the worker and the page; the error page and the console say why | Check that module points at a served file (/epoxy/index.mjs returns JavaScript, not your SPA's index.html), then setTransport() or reload |
transporthost event fired, sync XHR in pages hangs 30 s |
The worker could not start or import the module, so the transport runs in the page | Serve transportWorker.js from directory (or name it in init.assets); keep the module worker-safe |
TypeError from setTransport()
|
A descriptor for a page host, or an instance for a worker host | Match controller.transportHost
|
| "Transport modules must live on the proxy origin" |
RemoteController with a module URL on the host origin |
Serve the transport on the proxy origin and use that URL |
Epoxy fails to start, 404 for epoxy.wasm
|
Only index.mjs was copied |
Serve the whole dist/ directory |
| YouTube or other big-header sites fail, uploads kill every tab, fonts truncated | The npm release of epoxy | Install the pinned build (above) |
| Long uploads or long-lived sockets stall | wisp-js 0.5.2 or older | Upgrade to 0.5.3 or holyWisp |
| Pages that burst many requests to one host lose some | holyWisp's flood protection per-destination limit | floodProtection: { enabled: false } |
[net] never shows HTTP/3 |
libcurl, the relay refuses UDP (WISP_NO_UDP, allow-udp = off, proxy-udp = refuse with an upstream proxy), or the site advertises no h3 |
Use epoxy; allow UDP on the relay |
carrier stays websocket with why set, or the console says "the relay names no WebTransport session" |
No listener (holyWisp 0.5.3, wisp-js), UDP blocked between browser and relay, a TCP-only proxy in front of the relay's name, a certificate the document's hashes do not match, or an http: host page |
Use holyWisp nightly or the public relay; open the UDP port; set webtransport-url; serve the page over HTTPS |
| First load rides the WebSocket, the next one WebTransport | The session was not up within the first-start budget; the result is remembered | Nothing to do |
| WebRTC calls never connect | libcurl, or a relay without UDP and no TCP/TLS TURN in the page's iceServers
|
Use epoxy; allow UDP |
| A site works natively but not through STomp | Transport or relay, or STomp |
setTransport() to libcurl, or point at the public relay, and compare |
More symptoms are on Troubleshooting. Every option above is also listed in Configure STomp.
STomp is licensed under the GPL-3.0. Found a mistake in these pages? Open an issue.