RTCPeerConnection (TsgcRTCPeerConnection) — sgcWebSockets | eSeGeCe

RTCPeerConnection

Talk WebRTC from Delphi/C++Builder — ICE for connectivity, DTLS 1.3 for the keying handshake, SRTP for media, SCTP-over-DTLS for DataChannels. No browser required.

TsgcRTCPeerConnection

Native Delphi WebRTC peer — mirrors the W3C RTCPeerConnection surface (CreateOffer / CreateAnswer / SetRemoteDescription / AddIceCandidate / DataChannel) backed by the bundled ICE, DTLS 1.3, SRTP and SCTP stacks.

Component class

TsgcRTCPeerConnection

Protocol

WebRTC (W3C)

Platforms

Windows, macOS, Linux, iOS, Android

Edition

Enterprise

Offer / Answer / Connect

Add ICE servers, CreateOffer, send the SDP to the remote peer over your signalling channel, set the answer, and the data path lights up.

uses
  sgcP2P;

var
  Peer: TsgcRTCPeerConnection;
  Channel: TsgcRTCDataChannel;
begin
  Peer := TsgcRTCPeerConnection.Create(nil);
  Peer.IceServers.Add('stun:stun.l.google.com:19302');

  Peer.OnLocalDescription := procedure(Sender: TObject;
    const aSDP: string)
  begin
    SignalToPeer(aSDP); // over your WebSocket / WebRTC signalling
  end;

  Peer.OnDataChannel := procedure(Sender: TObject;
    aChannel: TsgcRTCDataChannel)
  begin
    Channel := aChannel;
    aChannel.OnMessage := procedure(Sender: TObject;
      const aText: string)
    begin
      Memo1.Lines.Add(aText);
    end;
  end;

  // outbound side
  Channel := Peer.CreateDataChannel('chat');
  Peer.CreateOffer;
end;
// uses: sgcP2P
TsgcRTCPeerConnection *Peer = new TsgcRTCPeerConnection(this);
Peer->IceServers->Add("stun:stun.l.google.com:19302");
TsgcRTCDataChannel *Channel = Peer->CreateDataChannel("chat");
Peer->CreateOffer();

What's inside

A native WebRTC peer that bundles ICE, DTLS 1.3, SRTP and SCTP into a single component — mirroring the W3C RTCPeerConnection API.

SDP Offer / Answer

CreateOffer and CreateAnswer generate RFC 8866 SDP with the right ICE-UFRAG / ICE-PWD / FINGERPRINT / SETUP attributes; SetRemoteDescription ingests the peer's SDP.

ICE-driven connectivity

Uses TsgcICEClient internally for candidate gathering and connectivity checks; AddIceCandidate feeds remote candidates as they trickle in from signalling.

DTLS 1.3 keying

After the selected ICE pair becomes writable, the component performs a DTLS 1.3 handshake (RFC 9147) and derives SRTP keys via SRTP-extractor.

DataChannels (SCTP-over-DTLS)

CreateDataChannel opens an SCTP stream multiplexed over DTLS — reliable / partial-reliable, ordered / unordered, with backpressure via BufferedAmount.

Media tracks

Audio / video tracks travel over SRTP. The companion TsgcWSPServer_RTCPeerConnection server-side signalling component lets you build SFU-style relays.

Browser-compatible

Interops with browser RTCPeerConnection — tested against Chromium / Firefox / Safari. Same SDP semantics, same ICE candidates, same DataChannel wire format.

Specifications & references

Authoritative sources for the protocol this component implements.

Documentation & Demos

Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.

Online Help — TsgcRTCPeerConnection Full property, method and event reference for this component.
Demo Project — Demos\35.P2P\05.RTCPeerConnection Ready-to-run example project. Ships inside the sgcWebSockets package — download the trial below.
Technical Document (PDF) Features, quick start, code samples for Delphi & C++ Builder and primary-source references — this component only.
User Manual (PDF) Comprehensive manual covering every component in the library.
Best value: All-AccessEvery eSeGeCe product, Premium Support included, from €1,059/year.
See All-Access pricing

Ready to Run WebRTC in Delphi?

Download the free trial and add native RTCPeerConnection to your Delphi applications.