TsgcRTCPeerConnection › Events › OnRTCConnect
Fired when the data channel is open and ready to send and receive data.
property OnRTCConnect: TsgcRTCConnectEvent;
// TsgcRTCConnectEvent = procedure(Sender: TObject; const aCandidatePair: TsgcICE_CandidatePair) of object
—
Raised when the end-to-end path is fully established: ICE has nominated a pair, the DTLS handshake (when enabled) has completed and the SCTP data channel is open. From this moment on you can call WriteData to transmit payloads to the remote peer, and incoming bytes will be delivered through OnRTCMessage. aCandidatePair exposes the specific local/remote endpoints that were selected for the session.
procedure TForm1.oRTCConnect(Sender: TObject;
const aCandidatePair: TsgcICE_CandidatePair);
begin
Log('data channel ready');
oRTC.WriteData('hello!');
end;