Reputation: 585
I have a requirement where my Websocket session should be able to communicate with each other.I am creating a Request Response model where my Client A would send a request on a Queue on which I have multiple subscriber agents (Ag1 and Ag2). I would expect that my requests would round robin between these 2 subscribers. Unfortunately, the event is broadcasted to both the agents rather than it being a one to one communication.
My Spring config
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/websocket").withSockJS();
}
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
config.setApplicationDestinationPrefixes("/app");
config.enableSimpleBroker("/queue", "/topic");
}
Client JS Code
requestResponse = new RequestResponse({
outgoingChannel : "/queue/clients",
incomingChannel : "/topic/broadcast/clients",
callbackFn : widget3eventHandler
},session);
Agent Subscriber Code
requestResponse = new RequestResponse({
outgoingChannel : "/topic/broadcast/clients",
incomingChannel : "/queue/clients",
callbackFn : widget3eventHandler,
processAll : true
},session);
Is this a bug in SIMP Broker or am i doing something wrong.
Upvotes: 2
Views: 999
Reputation: 59211
You can check this sample chat application if you want to know how to achieve client to client communication.
Upvotes: 3