From 1386b1b4dba4d2fa9d92bfe3c55e4f7f37eab9ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iwo=20Strzebo=C5=84ski?= Date: Mon, 19 Oct 2026 00:32:57 +0000 Subject: [PATCH] Add WebRTC signalling to the edge protocol A browser cannot signal to a gateway's go2rtc directly. Measured against go2rtc 1.9.14: it sends no Access-Control-Allow-Origin on any response, the SDP POST needs a preflight anyway because application/sdp is not a CORS-safelisted content type, and it checks its API password before CORS - so the preflight, which a browser always sends without credentials, gets a 401. A gateway is behind a workshop NAT besides, so nothing can dial in. So the cloud relays the SDP exchange over the socket the gateway already holds open: webrtc_offer down, webrtc_answer or webrtc_error back up. Signalling only - no video on this socket, and that is the design rather than a limitation of it. Media goes browser-to-gateway through a TURN relay, DTLS-SRTP encrypted, so neither the backend nor the relay can read it. The alternative was tunnelling fMP4 up this socket and streaming it from the API, which would have meant plaintext video through the cloud and - since