TsgcWSPServer_FilesMethods › WriteData

WriteData Method

Sends a plain text message to a connected client wrapped in the Files subprotocol envelope.

Syntax

function WriteData(aGuid, aMessage: string): Boolean;

Parameters

NameTypeDescription
aGuidstringGuid of the target client connection.
aMessagestringText payload to deliver to the client.

Return Value

True when the message was queued for the connection; False when the target connection was not found. (Boolean)

Remarks

The text is wrapped in the Files subprotocol message envelope (method message) so it is surfaced to the client's OnMessage event rather than to the underlying TsgcWebSocketServer. Use this to send control or application-level notifications while a file transfer is in flight.

Example

oFiles.WriteData(aConnection.Guid, 'transfer paused');

Back to Methods