TsgcWSPServer_Presence › Methods › Broadcast
Sends a message to all connected clients, or only to members of a given channel.
procedure Broadcast(const aText: string; const aChannel: string = '');
| Name | Type | Description |
|---|---|---|
aText | const string | The message text to broadcast. |
aChannel | const string | Optional 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. |
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.
// 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');