TsgcWSPServer_DatasetEvents › OnBinary

OnBinary Event

Fires when a client sends a binary frame to the server.

Syntax

property OnBinary: TsgcWSBinaryEvent;
// TsgcWSBinaryEvent = procedure(Connection: TsgcWSConnection; const Data: TMemoryStream) of object

Default Value

Remarks

Binary frames bypass the sgc JSON envelope; the server forwards the raw bytes to this event. Data is a TMemoryStream positioned at 0 and owned by the component — copy the content before the handler returns if you need to keep it. Text messages surface on OnMessage instead.

Example

procedure TForm1.oProtocolBinary(Connection: TsgcWSConnection; const Data: TMemoryStream);
begin
  Memo1.Lines.Add(Format('%d bytes from %s', [Data.Size, Connection.Guid]));
end;

Back to Events