WAMP | Publishers

게시자는 특정 피어가 아니라 추상 주소로서 topic(또는 채널)을 제공하여 이벤트를 보냅니다(게시합니다). Publish 메서드를 호출하고 topic 이름과 보내려는 메시지를 인수로 전달하기만 하면 됩니다. 이 메시지는 이 topic의 모든 구독자에게 전달됩니다. 참고로, 해당 topic에 메시지를 게시하기 위해 topic을 구독할 필요는 없습니다.

 

publish 메시지가 수신될 때 메시지가 클라이언트에 자동으로 브로드캐스트되므로 서버 측에서 구성할 것이 없습니다.

 

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');