Skip to content

lightgun-poc / lib/rtc

lib/rtc

PC-side WebRTC intake: turns a phone's SDP offer into an answer and feeds every DataChannel message into the same protocol handler the WebSocket uses.

Why WebRTC at all: the phone page is served from an HTTPS origin (GitHub Pages), and a secure page cannot open ws://<lan-ip> (mixed content, and Local Network Access does not cover WebSockets). WebRTC is exempt from mixed-content rules and brings its own DTLS encryption, so the PC needs no TLS certificate — the whole point of the QR setup flow.

werift (pure TypeScript) terminates the connection; a native stack cannot live inside the single executable. All werift usage stays behind PeerLike so tests inject a fake and API drift is contained here.

Interfaces

Functions

Released under the MIT License.