TsgcWSPClient_WAMP › Methods › WriteData
Sends a pre-built text or binary WAMP frame directly over the underlying WebSocket transport.
procedure WriteData(const aText: String);
| Name | Type | Description |
|---|---|---|
aText | const String | Ready-to-send WAMP JSON text frame (for example [2,"id","proc"] for a CALL). Transmitted verbatim as a WebSocket text frame. |
Low-level escape hatch for emitting experimental or server-specific WAMP messages that the high-level API (Call, Subscribe, Publish, etc.) does not expose. The text is written verbatim, so the caller is responsible for producing a well-formed WAMP array payload. Misuse can desynchronise the session or cause the server to disconnect the client.
// send a hand-crafted WAMP PREFIX frame
WAMP.WriteData('[1,"calc","http://example.com/simple/calc#"]');
procedure WriteData(aStream: TStream; aSize: Integer = 0; const aStreaming: TwsStreaming = stmNone);
| Name | Type | Description |
|---|---|---|
aStream | TStream | Source stream whose bytes are sent as a binary WebSocket frame. The current position is respected and the stream is read forward. |
aSize | Integer | Number of bytes to send from the current position. Pass 0 to transmit from the current position to the end of the stream. |
aStreaming | const TwsStreaming | Fragmentation mode: stmNone sends the payload as a single frame; stmStart, stmContinue and stmEnd emit WebSocket continuation frames when the payload is split into chunks. |
Binary companion of the text overload. WAMP v1 is a JSON-over-text protocol, so this form is intended for companion payloads (for example hand-crafted ping frames, out-of-band file transfers or experimental extensions) rather than standard RPC/PubSub traffic. Bypasses all WAMP bookkeeping — no OnCallResult, OnCallError or OnEvent correlation is performed for data sent this way.
var
oStream: TFileStream;
begin
oStream := TFileStream.Create('payload.bin', fmOpenRead);
try
WAMP.WriteData(oStream);
finally
oStream.Free;
end;
end;