TsgcWSPServer_WAMPEvents › OnBinary

OnBinary Event

Fires when a client sends a binary WebSocket frame that is not part of the standard WAMP v1 text protocol.

Syntax

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

Default Value

Remarks

WAMP v1 is a JSON-over-text protocol so no binary frame is ever required by the spec. This handler is the escape hatch for application-specific payloads that ride over the same socket (file uploads, compressed batches, custom telemetry). The stream position is at zero on entry; the buffer is owned by the component and will be released when the handler returns — copy any bytes you need before that.

Example


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

Back to Events