WebRTC (WHEP)
For ultra-low latency (<50ms) live monitoring, RUSEON Core provides a production-grade WebRTC streaming pipeline powered by Pion WebRTC v4.
WHEP Protocol Architecture
RUSEON Core implements the standard WHEP (WebRTC HTTP Egress Protocol) with Non-Trickle ICE:
- The browser client sends an HTTP POST request containing its SDP Offer to
/stream/webrtc/whep/:id. - The server initializes a
PeerConnectionusing its pre-warmedwebrtc.APIinstance, attaches the camera's H.264 video track, and creates the"metadata"DataChannel. - The server generates and returns the SDP Answer (
201 CreatedwithContent-Type: application/sdp). - Video packets and AI metadata flow directly to the client over SRTP / SCTP.
High-Performance Optimizations
1. Pre-generated DTLS Certificate
Generating ECDSA/RSA certificates at runtime causes noticeable 100-300ms connection delays. RUSEON Core pre-generates a single ECDSA P-256 certificate at server startup and shares it across all peer connections, making initial handshakes instantaneous.
2. UDP Port Multiplexer (Single UDP Port)
Instead of allocating random ephemeral UDP ports for every viewer (which complicates firewall configurations), RUSEON Core multiplexes all WebRTC ICE sessions through a single configurable UDP port:
server:
webrtc:
listen_port: 85553. NAT 1:1 Public IP Mapping
For deployments behind NAT, Docker, or Kubernetes LoadBalancers, external IPs are explicitly advertised to clients:
server:
webrtc:
nat_1_to_1_ips:
- "203.0.113.10"4. Custom STUN / TURN Configuration
Enterprise air-gapped networks and strict symmetric NATs are fully supported via configurable TURN relays:
server:
webrtc:
ice_servers:
- "stun:stun.l.google.com:19302"
- "turn:turn.company.local:3478"
ice_transport_policy: "all" # or "relay"
turn_username: "webrtc_user"
turn_password: "turn_password"SPS / PPS Keyframe Injection
To allow clients to start decoding immediately upon connection without waiting for the camera's native GOP cycle, RUSEON Core caches SPS/PPS parameter sets from the RTSP SDP handshake and prepends them in Annex-B format before every IDR Keyframe.
Real-Time Metadata DataChannel
Alongside the video track, RUSEON Core opens an SCTP DataChannel labeled "metadata". AI bounding boxes and event objects pushed via gRPC are broadcasted in JSON format over this channel with zero buffering, synchronized with the video playback.