What is Signaling?
Signaling is the process of coordinating communication between two peers. In WebRTC, this involves exchanging session information (SDP) and network connectivity information (ICE candidates) before a peer-to-peer connection can be established.WebRTC does not specify a signaling protocol - you can use WebSockets, HTTP, MQTT, or any other mechanism to exchange signaling messages between peers.
Session Description Protocol (SDP)
SDP is a text format that describes multimedia sessions. In Pion WebRTC, SDP is represented by theSessionDescription type:
sessiondescription.go
SDP Types
There are four types of SDP messages:Offer
Initial proposal from the caller with supported codecs, media tracks, and capabilities.
Answer
Response from the callee with its own capabilities, negotiated with the offer.
Pranswer
Provisional answer - a partial answer that may be updated later.
Rollback
Cancel a previous offer/answer and return to the stable state.
The Offer/Answer Exchange
The signaling process follows a well-defined sequence:Creating an Offer
The caller creates an offer describing its capabilities:peerconnection.go
Creating an Answer
The callee receives the offer and creates an answer:peerconnection.go
Setting Descriptions
Local Description
Setting the local description commits your offer or answer:peerconnection.go
Remote Description
peerconnection.go
ICE Trickle
ICE trickle allows sending candidates incrementally rather than waiting for all candidates:sessiondescription.go
Trickle ICE significantly reduces connection setup time by allowing ICE candidate exchange to happen in parallel with the offer/answer exchange.
Perfect Negotiation
Perfect negotiation is a pattern that eliminates glare (both sides creating offers simultaneously):Signaling Server Examples
WebSocket Signaling
HTTP Polling
SDP Manipulation
Sometimes you need to modify SDP before setting it:Renegotiation
Renegotiation updates an existing connection:Next Steps
ICE & Connectivity
Learn about ICE candidates and NAT traversal
Media Streams
Working with audio and video tracks