TsgcWSPServer_WebRTCEvents › OnMessage

OnMessage Event

Fires for incoming text frames that the signalling decoder did not route to a dedicated subscription or WebRTC relay event.

Syntax

property OnMessage: TsgcWSMessageEvent;
// TsgcWSMessageEvent = procedure(Connection: TsgcWSConnection; const Text: string) of object

Default Value

Remarks

The standard signalling envelopes (sgc@broadcast, sgc@subscribe, sgc@unsubscribe, sgc@webrtc, sgc@protocol) are consumed by the decoder and raised through their dedicated events (OnBeforeSubscription, OnSubscription, OnUnSubscription). Any other text frame — an application-specific extension, a custom control message or the text payload of a broadcast that the server also wants to observe — surfaces here. Silently ignoring the frame is safe; the sgc WebRTC signalling flow does not require the server to acknowledge unrecognised messages.

Example


procedure TForm1.WebRTCServerMessage(Connection: TsgcWSConnection;
  const Text: string);
begin
  Memo1.Lines.Add(Format('[%s] message: %s', [Connection.Guid, Text]));
end;

Back to Events