TsgcWSPClient_STOMP_RabbitMQMethods › WriteData

WriteData Method

Writes raw text or stream data over the underlying WebSocket connection.

Overloads

Overload 1

Syntax

procedure WriteData(const aText: String);

Parameters

NameTypeDescription
aTextconst StringRaw payload to send as a text WebSocket frame. The STOMP layer is bypassed, so the caller is responsible for producing a valid STOMP frame when one is required.

Remarks

Low-level escape hatch used to send text payloads that the STOMP layer does not model directly (custom frames, diagnostics, etc.). Prefer the Publish* / Subscribe* helpers for regular STOMP traffic.

Example

sgcRabbitMQ.WriteData('custom-frame');

Overload 2

Syntax

procedure WriteData(aStream: TStream; aSize: Integer = 0; const aStreaming: TwsStreaming = stmNone);

Parameters

NameTypeDescription
aStreamTStreamBinary source to send. The stream is read starting at its current position.
aSizeIntegerNumber of bytes to send from the stream. When 0 (default) the component sends from the current position until the end of the stream.
aStreamingconst TwsStreamingFragmentation mode: stmNone sends a single binary frame; other values split the payload into a sequence of continuation frames, useful for very large streams.

Remarks

Binary overload intended for low-level transport scenarios (file transfer, custom binary protocols layered on top of the same WebSocket connection). The STOMP layer is bypassed.

Example

var
  oStream: TFileStream;
begin
  oStream := TFileStream.Create('payload.bin', fmOpenRead);
  try
    sgcRabbitMQ.WriteData(oStream, 0, stmNone);
  finally
    oStream.Free;
  end;
end;

Back to Methods