TsgcWSPServer_DatasetMethods › WriteData

WriteData Method

Sends a message to the connection identified by its Guid using the sgc envelope.

Syntax

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

Parameters

NameTypeDescription
aGuidstringConnection Guid of the target client; pass a semicolon-separated list to reach several connections at once.
aMessagestringText payload wrapped in a method=message envelope and surfaced on the client through its OnMessage event.

Return Value

True when the underlying transport accepts the message, False when no matching connection is found or the send fails (Boolean)

Remarks

Unlike Publish and Broadcast, WriteData targets specific clients by Guid and bypasses the PubSub fan-out. The payload is wrapped in the sgc envelope (method=message) so recipients raise OnMessage, not OnBinary or OnEvent.

Example

oProtocol.WriteData(aConnection.Guid, 'welcome');

Back to Methods