mix-websocket
@nymproject/mix-websocket (opens in a new tab) exposes MixWebSocket, a class that mirrors the browser WebSocket (opens in a new tab) API for traffic that needs to travel through the Nym mixnet. WS and WSS endpoints are reached via the IPR (Internet Packet Router) exit gateway; the destination server sees the connection coming from the IPR's IP, not yours.
┌──────────────────────────────────────────────────────────────┐
│ Your browser app │
│ └─ new MixWebSocket('wss://...') │
│ └─ mix-tunnel (smolmix-wasm, Web Worker) │
│ └─ smoltcp userspace TCP/IP + rustls TLS │
│ └─ Nym mixnet → IPR exit gateway │
│ └─ destination WS server │
└──────────────────────────────────────────────────────────────┘The TLS handshake (for wss:// targets) terminates inside the WASM bundle, end-to-end with the destination. The IPR sees TCP frames addressed to the destination's IP and port; for WSS, the payload is TLS ciphertext.
In this section
- Get started: install and open your first mixnet WebSocket.
- Reference: sending and receiving, error handling, configuration.
- Concepts & security: how it differs from the browser WebSocket, and the security model.
- TypeDoc reference: generated from the source.
- Browser example (opens in a new tab): a runnable example app.