TsgcWSPClient_STOMP_ActiveMQMethods › WriteData

WriteData Method

Low-level write of a raw STOMP frame or stream over the WebSocket connection.

Overloads

Overload 1

Syntax

procedure WriteData(const aText: String);

Parameters

NameTypeDescription
aTextconst StringRaw text payload written as-is to the WebSocket; callers are responsible for supplying a fully-formed STOMP frame when bypassing the high-level helpers.

Remarks

Bypasses the Publish/Subscribe/ACK helpers and writes the supplied text directly to the transport. Use only when ActiveMQ requires a non-standard frame or when replaying a captured frame; no validation is performed on the content.

Example

oActiveMQ.WriteData('SEND' + #10 + 'destination:/queue/foo' + #10 + #10 + 'hello' + #0);

Overload 2

Syntax

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

Parameters

NameTypeDescription
aStreamTStreamSource stream whose bytes are written to the WebSocket transport; position is advanced as data is read.
aSizeIntegerNumber of bytes to write; pass 0 to write from the current position to the end of the stream.
aStreamingconst TwsStreamingFragmentation mode (stmNone, stmStart, stmContinue, stmEnd) used when the payload must be split across multiple WebSocket frames.

Remarks

Stream overload for sending large payloads without loading them into a string first. Useful for relaying pre-built frames or large binary bodies. The aStreaming parameter lets the caller drive a multi-frame WebSocket message manually, which is required by some ActiveMQ configurations when the payload exceeds the negotiated maximum frame size.

Example

oStream := TFileStream.Create('frame.bin', fmOpenRead);
try
  oActiveMQ.WriteData(oStream);
finally
  oStream.Free;
end;

Back to Methods