Why Pixel Streaming goes black on the public internet: WebRTC, TURN and single-port multiplexing
Most teams that have shipped a Pixel Streaming project have seen this: everything works on the LAN, but once deployed to the public internet or a customer site, the player page loads, signaling connects, and the video sits at "connecting" forever. The cause is almost always the same: the media stream has no path.
Which path does WebRTC media take?
Pixel Streaming video travels over WebRTC. After the browser and UE exchange SDP, each side gathers candidate addresses (ICE candidates) and tries to connect:
- host: local addresses, which work directly on the same LAN;
- srflx: NAT-mapped addresses discovered through STUN, which need both NATs to allow UDP hole punching;
- relay: relayed through a TURN server, which only requires the browser to reach the TURN server.
By default, all of these rely on UDP. A public server either maps a large range of UDP ports or runs a publicly reachable TURN server; corporate firewalls usually allow only TCP 443; and with an HTTP reverse proxy in front, UDP is out of the question.
The key step: TURN over TCP/TLS
WebRTC media cannot go through an HTTP reverse proxy, but the TURN protocol itself supports TCP and TLS: the browser opens one TCP (or TLS) connection to TURN, and TURN forwards the media to UE over UDP. Put TURN on the gateway and the browser only needs TCP to the gateway, while all UDP between the gateway and UE stays inside the network.
Three kinds of traffic on one port
The remaining question is whether web pages, wss signaling and TURN can share one port. UEPS uses nginx's stream module to split connections at layer 4 by their characteristics:
| Connection | Goes to |
|---|---|
| TLS with ALPN (a browser opening a page or a wss connection) | The ps-platform viewer port (127.0.0.1:8088): player page and viewer signaling |
| TLS without ALPN (the browser's TURNS) | nginx terminates TLS and hands it to the built-in TURN (127.0.0.1:3478) |
| Plain TCP (TURN) | Straight to the built-in TURN |
| Plain HTTP | The built-in TURN recognizes an HTTP request and passes it to nginx's internal http entry, so http:// works on the same port too |
Browsers always send ALPN (h2 or http/1.1) when opening a page, while WebRTC's TURNS connections do not, and that is what the split relies on. One port therefore carries http://, https://, wss signaling, TURN and TURNS.
Why port forwarding needs no configuration
The TURN addresses the platform gives the browser are not hard-coded; they are built from the host and port the browser used to open the player page, for example turn:{host}:{port}?transport=tcp and turns:{host}:{port}?transport=tcp. Whatever external port the router forwards to the gateway's 443, the browser receives TURN addresses that point to the port it can actually reach. TURN credentials are short-lived and signed by the platform with a shared secret; the built-in TURN appears as @builtin in the settings.
LAN viewers do not use the relay
Viewers on the same LAN prefer host candidates during ICE and connect to UE directly, without the relay and without using gateway bandwidth. The Viewer sessions page in UEPS shows each viewer's path ("direct", "TURN TCP" or "TURN TLS") with bitrate, latency and frame rate. Adding stats=1 to the player URL shows a status overlay: remote viewers should see a TURN relay over TCP, LAN viewers a direct connection.
Ports at a glance
| Port | Listens on | Who connects | Purpose |
|---|---|---|---|
| 443 (configurable / mappable) | 0.0.0.0 | Browsers | The only port that must be public |
| 80 (optional) | 0.0.0.0 | Browsers | Redirect to https, certificate issuance |
| 88 | 0.0.0.0 | Operators, UE, agents on the LAN | Console / API / UE signaling / agents, never public |
| 8088 | 127.0.0.1 | nginx only | Viewer port |
| 3478 | 127.0.0.1 | nginx only | TCP listener of the built-in TURN |
| 49160-50159/udp | Gateway LAN IP | UE render machines | TURN relay ports, internal only |
| 9180 | 127.0.0.1 | Health checks | nginx status port |
Common pitfalls
- Health checks on 443 fail: probes usually do not send ALPN and are treated as TURNS. Check
127.0.0.1:9180/healthzinstead. - Black screen, stuck at connecting: make sure
/healthzreports turn=up, that the TURN relay address is a LAN IP UE can reach, that render machines can ping the gateway, and that the gateway's UDP relay port range is open internally. - The page loads from outside but there is no video: usually a plain HTTP reverse proxy sits in front without a TURN split; see "Why the video disappears behind another reverse proxy".
- No newly started instance shows video: check whether a TURN entry meant only for UE under System settings, TURN was changed to an address UE cannot reach, such as a public IP.
Capacity
All relayed traffic passes through the gateway; according to the project's own measurements, relay bandwidth is about 600 Mbps per 8 cores. Beyond that, add gateways and attach different render machines to each. LAN viewers bypass the relay and do not count against this capacity. See the UEPS product page for deployment details.