TsgcWSPServer_sgc › 이벤트 › OnFragmented
클라이언트로부터 수신된 프래그먼트화된 WebSocket 메시지의 각 프래그먼트에 대해 발생합니다.
property OnFragmented: TsgcWSFragmentedEvent;
// TsgcWSFragmentedEvent = procedure(Connection: TsgcWSConnection; const Data: TMemoryStream; const OpCode: TOpCode; const Continuation: Boolean) of object
—
RFC 6455 프래그먼트당 한 번 발생합니다. OpCode는 첫 프래그먼트(opText 또는 opBinary)를 표시하며, 후속 프래그먼트는 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;