Does Crosslink require port forwarding?
No. On the same network the phone dials the host’s own address. From another network,networkMode: "remote" asks the router for an inbound port over
NAT-PMP, PCP or UPnP — automatically, with nothing to configure. Where that is
impossible (carrier-grade NAT, a network you do not control), a relay carries
the connection over outbound sockets only.
Does Crosslink require a central server?
No. With no services at all, a phone pairs and connects directly to the host over the address in the QR:What happens when the host goes offline?
The client detects the disconnection and enters reconnect state:Route priority
The pairing QR lists every route the host genuinely has, tagged by kind, and the client tries them in this order:lan; it is never advertised as though it were reachable from the
internet.
Once connected, WebRTC upgrade can move traffic onto a direct
peer-to-peer DataChannel, which matters mainly for relayed sessions.
Network topology support
Same network (LAN)
- Host binds
ws://0.0.0.0:port(withbind: "all") - Client discovers host via signaling presence or manual config
- Lowest latency, no external services
CROSSLINK_LAN_HOST=192.168.1.42 in the environment — no code
change needed. The reference PWA’s dev server (apps/demo-pwa) reads the same
variable for its QR code.
Cross-network (relay)
- Host allocates channel on relay
- Client joins via channel ID
- Works through CGNAT, firewalls, double-NAT
- Adds one network hop
Mixed (LAN + relay)
NAT traversal
Two independent mechanisms, used for different things: Getting an inbound port (networkMode: "remote") uses NAT-PMP (RFC 6886),
PCP (RFC 6887) and UPnP IGD, plus STUN (RFC 5389) to learn the public address.
The router’s own report wins over STUN when they disagree, since a VPN changes
what STUN sees. Details and limits: Remote access.
Getting through a NAT you cannot map uses a relay: both sides make outbound
connections and the relay forwards encrypted frames between them. This works
through CGNAT, double NAT and restrictive firewalls, at the cost of one hop.
The relay only ever sees ciphertext.
Firewall considerations
In production, signaling and relay run behind a reverse proxy on port 443 (WSS mandatory).
Bandwidth
The relay adds overhead for encrypted traffic. Reduce relay usage by upgrading to WebRTC:Offline behavior
When the host is unreachable:- Idempotent RPC calls are queued and replayed after reconnection
- Non-idempotent calls fail immediately with
not_connected - Event subscriptions are restored after reconnection
- Transport hints are persisted locally for faster reconnection