webrtc_signal
Server-side WebRTC signaling over Phoenix Channels.
Channel topic: webrtc:signal
Events:
Client -> Server:
set_idpayload:{ "public_id": "...", "private_id": "..." }handshakepayload:{ "to": "...", "handshake": <any JSON> }
Server -> Client:
handshakepayload:{ "from": "...", "handshake": <any JSON> }
SetID returns:
-
ok:
{ "result": "ok" } -
error:
{ "reason": "in-use" }or{ "reason": "auth failed" }
Handshake returns:
-
ok:
{ "result": "delivered" } -
error:
{ "reason": "user not found" }
Integrate into a Phoenix app
In your Endpoint (e.g. lib/my_app_web/endpoint.ex), add:
socket "/webrtc_socket", WebrtcSignal.Socket,
websocket: true,
longpoll: falseThen your client connects to:
ws://HOST/webrtc_socket
wss://HOST/webrtc_socket
When you run multiple BEAM nodes, make sure they are connected via distributed Erlang so :global can see registrations across the cluster.