TsgcWSPServer_Dataset › Events › OnBinary
Fires when a client sends a binary frame to the server.
property OnBinary: TsgcWSBinaryEvent;
// TsgcWSBinaryEvent = procedure(Connection: TsgcWSConnection; const Data: TMemoryStream) of object
—
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.
procedure TForm1.oProtocolBinary(Connection: TsgcWSConnection; const Data: TMemoryStream);
begin
Memo1.Lines.Add(Format('%d bytes from %s', [Data.Size, Connection.Guid]));
end;