TsgcWSPClient_WAMPMethods › Publish

Publish Method

Broadcasts an event payload to every subscriber of the given topic, with optional exclude/eligible session lists.

Syntax

procedure Publish(const aTopicURI, aEvent: string; const aExclude: string = ''; const aEligible: String = '');

Parameters

NameTypeDescription
aTopicURIconst stringFully-qualified URI of the topic, or a prefix:name CURIE previously registered with Prefix.
aEventconst stringEvent payload, typically JSON. Delivered verbatim to every subscriber in the Event argument of OnEvent.
aExcludeconst stringOptional JSON array of session ids that must NOT receive the event (blacklist). Pass "true" to exclude the publisher itself when the server supports the eligible/excludeMe extension.
aEligibleconst StringOptional JSON array of session ids that are the only recipients allowed (whitelist). Leave empty to broadcast to all subscribers not covered by aExclude.

Remarks

Sends a WAMP v1 PUBLISH frame (type id 7). PubSub is fire-and-forget: there is no acknowledgement from the server and no delivery confirmation to the publisher. The event fans out to every session whose Subscribe URI matches aTopicURI exactly (WAMP v1 does not support wildcard topics). Use aExclude and aEligible together to implement private rooms or to prevent echo-back to the sender.

Example


WAMP.Publish('http://example.com/chat#lobby',
  '{"user":"alice","text":"hello"}');

Back to Methods