Skip to content

ADR-0002: WHIP/WHEP Protocol Integration

Status: Approved Date: 2024 Decision Makers: Core team

Context

Go-Live needs a signaling protocol for WebRTC stream publishing and playback. The signaling mechanism determines how clients establish connections with the server.

Decision

Adopt WHIP (WebRTC-HTTP Ingestion Protocol) for publishing and WHEP (WebRTC-HTTP Egress Protocol) for playback.

WHIP Publishing Flow

WHEP Playback Flow

API Contract

MethodPathRequestResponse
POST/api/whip/publish/{room}SDP OfferSDP Answer (201)
POST/api/whep/play/{room}SDP OfferSDP Answer (201)

Both endpoints accept application/sdp content type and return application/sdp in the response body.

Rationale

Why WHIP/WHEP over WebSocket signaling

AspectWHIP/WHEPWebSocket
InfrastructureStandard HTTPRequires WebSocket support
CDN/ProxyWorks with any reverse proxyNeeds WebSocket-aware proxy
Client complexitySimple POST requestPersistent connection management
Firewall traversalHTTP(S) is universally allowedMay be blocked
ScalingStateless HTTP, easy to scaleStateful connections

Why WHIP/WHEP over custom protocol

  • Interoperability: OBS Studio, browsers, and libraries support WHIP/WHEP
  • Standards-track: IETF drafts with growing adoption
  • Simplicity: One HTTP request per connection (no trickle ICE in basic mode)

Integration Architecture

Alternatives Considered

WebSocket-based signaling

  • Rejected: Adds infrastructure complexity
  • Clients must maintain persistent connections
  • Harder to scale horizontally

gRPC-based signaling

  • Rejected: Not natively supported in browsers
  • Requires gRPC-Web proxy layer

Custom HTTP API

  • Rejected: Would work but loses interoperability
  • WHIP/WHEP are becoming the standard

Consequences

  • Simple HTTP-based signaling
  • Compatible with OBS Studio and modern browsers
  • No WebSocket infrastructure needed
  • Basic mode does not support trickle ICE (all candidates in SDP)

Released under the MIT License.