TsgcWebSocketLoadBalancerServerEvents › OnFragmented

OnFragmented Event

Fires when the load balancer receives a fragmented WebSocket frame on one of its own sessions.

Syntax

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

Default Value

Remarks

OnFragmented is inherited from the underlying HTTP/WebSocket server and is raised for each fragmented frame received on a connection terminated directly by the load balancer. Data is the fragment payload, OpCode identifies whether the original message is text or binary, and Continuation is True for every fragment after the first one. Enable this event through Options.FragmentedMessages. For fragments received on sessions that are being forwarded to a backend, handle OnClientFragmented instead, which also exposes the Handled flag used by the forwarder.

Example


procedure OnFragmented(Connection: TsgcWSConnection; const Data: TMemoryStream;
  const OpCode: TOpCode; const Continuation: Boolean);
begin
  Log(Format('Fragment: op=%d cont=%s size=%d',
    [Ord(OpCode), BoolToStr(Continuation, True), Data.Size]));
end;

Back to Events