TsgcWSPServer_WebRTC › Events › OnBinary
Fires when a peer sends a binary WebSocket frame that is not part of the JSON-text signalling protocol.
property OnBinary: TsgcWSBinaryEvent;
// TsgcWSBinaryEvent = procedure(Connection: TsgcWSConnection; const Data: TMemoryStream) of object
—
SDP offers, SDP answers and ICE candidates are JSON text and never travel as binary frames; browser media (audio/video/data channels) runs on a different RTCPeerConnection socket negotiated out-of-band and never reaches this handler. OnBinary is the escape hatch for application-specific payloads that ride over the same signalling socket (file thumbnails, encoded snapshots, custom telemetry). Data.Position is zero on entry; the buffer is owned by the component and released when the handler returns — copy any bytes you need before that.
procedure TForm1.WebRTCServerBinary(Connection: TsgcWSConnection;
const Data: TMemoryStream);
begin
Memo1.Lines.Add(Format('[%s] binary: %d bytes',
[Connection.Guid, Data.Size]));
end;