TsgcWSPServer_DatasetEvents › OnFragmented

OnFragmented Event

Fires for each fragment of a fragmented WebSocket message received from a client.

Syntax

property OnFragmented: TsgcWSFragmentedEvent;
// TsgcWSFragmentedEvent = procedure(Connection: TsgcWSConnection; const Data: TMemoryStream; const OpCode: TOpCode; const Continuation: Boolean) of object

Default Value

Remarks

Fires once per RFC 6455 fragment. OpCode marks the first fragment (opText or opBinary), subsequent fragments arrive with opContinuation. Continuation is True while more fragments are expected and False on the final fragment. Reassembly, decoding and OnMessage/OnBinary dispatch are skipped while a handler is assigned, so the application is fully responsible for collecting the fragments.

Example

procedure TForm1.oProtocolFragmented(Connection: TsgcWSConnection;
  const Data: TMemoryStream; const OpCode: TOpCode; const Continuation: Boolean);
begin
  Memo1.Lines.Add(Format('fragment: %d bytes, more=%s',
    [Data.Size, BoolToStr(Continuation, True)]));
end;

Back to Events