WAMP | Publishers

A publisher sends (publishes) an event by providing a topic (aka channel) as the abstract address, not a specific peer. Just call Publish method and pass as arguments the name of the topic and the message you want to send. This message will be delivered to all subscribers of this topic. As a note, there is no need to subscribe to a topic to publish messages on this topics.

 

There is no need to configure anything on server side, because messages are automatically broadcasted to clients when a publish message is received.

 

WAMP Client

 


oClient := TsgcWebSocketClient.Create(nil);
oClient.Host := '127.0.0.1';
oClient.Port := 80;
oClientWAMP := TsgcWSPClient_WAMP.Create(nil);
oClientWAMP.Client := oClient.
oClientWAMP.OnMessage := OnMessageEvent;
oClient.Active := True;
 
// Publish a message to all subscribers
oClient.Publish('myTopic', 'Hello subscribers myTopic');