WebRTC signaling
At places where WebRTC is needed (e.g. live audio playback), Angelcam uses a simple WebSocket-based signaling protocol.
Connection
Section titled “Connection”Keep the WebSocket connection open for the entire WebRTC session — closing it terminates the session.
- Client SHOULD send WebSocket PING messages at regular intervals and expect a PONG within a reasonable timeout.
- Client MUST respond to PING messages sent by the server.
Message format
Section titled “Message format”Both peers exchange WebSocket TEXT messages containing JSON. Every message must have a type field:
{ "type": "MESSAGE_TYPE", ...}MESSAGE_TYPE is one of: offer, answer, candidate.
offer and answer
Section titled “offer and answer”{ "type": "offer", "sdp": "v=0\r\n..."}The sdp field contains the proposed or selected session description.
candidate
Section titled “candidate”{ "type": "candidate", "candidate": { "candidate": "candidate:...", "mid": "0", "ufrag": "ABCD" }}candidate can be null (end-of-candidates signal) or an ICE candidate object with:
| Field | Description |
|---|---|
candidate | ICE candidate in SDP attribute format (without the leading a=) |
mid | Media ID of the stream the candidate belongs to |
ufrag | Username fragment for the media stream |