TsgcWSPServer_sgc事件 › OnFragmented

OnFragmented 事件

从客户端接收的每个分片 WebSocket 消息的分片触发一次。

语法

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

默认值

备注

每个 RFC 6455 片段触发一次。OpCode 标记第一个片段(opTextopBinary),后续片段以 opContinuation 到达。Continuation 在有更多片段待接收时为 True,在最后一个片段时为 False。分配处理程序后,重组、解码以及 OnMessage/OnBinary 分发将被跳过,因此应用程序完全负责收集片段。

示例

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;

返回事件