TsgcWSPServer_Dataset › Methods › Publish
Publishes a message to every client subscribed to a channel.
procedure Publish(const aMessage, aChannel: String; const aExclude: String = ''; const aInclude: String = ''; const aQueue: TwsQueue = queueLevel0);
| Name | Type | Description |
|---|---|---|
aMessage | const String | Payload to publish; delivered to subscribers through their OnEvent handler. |
aChannel | const String | Channel the message is published on; wildcards such as news* fan out to every matching channel with active subscribers. |
aExclude | const String | Semicolon-separated list of connection Guids to skip when fanning out. |
aInclude | const String | Semicolon-separated list of connection Guids the publication is restricted to. |
aQueue | const TwsQueue | Retention policy: queueLevel0 (no retention), queueLevel1 (keep last message per channel), or queueLevel2 (queue every message) so subscribers that connect later receive them. |
Full overload. Expands wildcard channels against current subscriptions, writes a retained copy into the server-side queue when aQueue is queueLevel1 or queueLevel2, and then broadcasts the payload to all matching subscribers honouring the Exclude/Include filters. This is independent of the dataset sync channel, so it is the right choice for side-channel notifications and chat-style events.
oProtocol.Publish('breaking news', 'news');
oProtocol.Publish('sticky banner', 'news', '', '', queueLevel1);
procedure Publish(const aMessage, aChannel: String; const aQueue: TwsQueue);
| Name | Type | Description |
|---|---|---|
aMessage | const String | Payload to publish; delivered to subscribers through OnEvent. |
aChannel | const String | Channel to publish on; wildcards are supported. |
aQueue | const TwsQueue | Retention policy (queueLevel0, queueLevel1, queueLevel2) for late subscribers. |
Convenience overload that delegates to the full overload with empty Exclude and Include filters. Use this when you only need to select a retention level and want every matching subscriber to receive the message.
oProtocol.Publish('tick', 'prices', queueLevel1);