TsgcWSPServer_PresenceMethods › Broadcast

Broadcast Method

Sends a message to all connected clients, or only to members of a given channel.

Syntax

procedure Broadcast(const aText: string; const aChannel: string = '');

Parameters

NameTypeDescription
aTextconst stringThe message text to broadcast.
aChannelconst stringOptional channel name. When empty (the default) the message is delivered to every client connected to the Presence protocol; when set, only members subscribed to that channel receive it.

Remarks

Broadcast lets the server push a text message without going through any client Publish call. With an empty channel name the message is relayed to every client using the Presence protocol; passing a channel name restricts delivery to the members currently subscribed to that channel.

Example

// send to every client connected to the Presence protocol
oPresenceServer.Broadcast('Server maintenance in 5 minutes');

// send only to members subscribed to the 'news' channel
oPresenceServer.Broadcast('Breaking news', 'news');

Back to Methods