Peer Reflexive Candidate
No server neededA peer reflexive (prflx) candidate is discovered dynamically during ICE connectivity checks – it is the address the remote peer observes for your STUN Binding Requests. Unlike srflx (discovered via a STUN server), prflx is discovered by the peer itself during the check phase. Peer reflexive candidates are rare in practice but matter for aggressive ICE nomination with NAT types that assign new ports during the check phase.
How it works
Peer reflexive candidates are created by the ICE agent when a STUN Binding Request arrives from a source address that doesn't match any known remote candidate. The receiving agent creates a prflx candidate for the observed address and uses it in connectivity checks.
When prflx candidates appear: 1. ICE checks are running using a srflx candidate address 2. Due to symmetric NAT, the actual source port in the STUN check differs from the srflx candidate 3. The remote peer's ICE agent discovers the new address and creates a prflx candidate
In practice: - Most connections don't use prflx candidates – they are an artifact of symmetric NAT interaction - Prflx candidates have higher priority than srflx because they represent a more specific observed path - The WebRTC spec requires support for recognizing and using prflx candidates - Developers rarely need to handle prflx explicitly – the RTCPeerConnection handles it internally
The prflx candidate type appears in RTCIceCandidatePairStats when a prflx path was selected.
SDP Example
# Peer reflexive candidates do NOT appear in the initial SDP offer/answer
# They are discovered during ICE connectivity checks
# and reported via RTCPeerConnection stats
// Check if prflx was used:
const stats = await pc.getStats();
stats.forEach(report => {
if (report.type === 'candidate-pair' && report.state === 'succeeded') {
console.log('local candidate type:',
stats.get(report.localCandidateId)?.candidateType); // may be "prflx"
}
});Pros
- +Discovered during connectivity checks – no additional STUN server round-trip
- +Higher priority than srflx – preferred when available
- +Enables connections through NAT types that reassign ports
Cons
- !Only discovered during ICE checks, not during candidate gathering
- !Rare in practice – most connections use host, srflx, or relay
- !Not visible in initial SDP – only appears in RTCStats after negotiation
Priority
High (110 × 2^24 + 65535 × 2^8 + (256-component))