Closed lorenzoGP closed 7 years ago
snippets look ok i think.. please reference a sample app reproducing the problem.
I was able to find the problem while preparing the sample app ; ). I have to say that while I found some post about this problem on the internet no one shared a possible solution, so I am glad to share with you what I discovered
When I have both of this tags declared
@Controller <------
class WebSocketController {
@MessageMapping("/hello") <------
@SendToUser("/queue/hello")
protected String hello(Message<?> message,PagosEvento dates){
return 'Example: '+dates.dateFrom
}
}
I get duplicates messages send to client, the solution for me was removing @Controller
All the confusion with the tags came following the Spring docs on websockets where they give example as,
@Controller
public class GreetingController {
@MessageMapping("/greeting") {
public String handle(String greeting) {
return "[" + getTimestamp() + ": " + greeting;
}
}
Hope this solution helps anyone with similar problem
ok just to clarify: you added a spring @Controller
annotation to a grails controller, right? then the duplicte messages make sense because the spring as well as the grails method resolver would have detected the message handling method.
thank you for the feedback! this one is good to close, i guess?
Yes, is just as you pointed out!
Hi I am getting this strange behavior where my server receives duplicate calls from the client when this calls send: (I am using Sockjs + STOMP for client)
Code where the connection is established :
Server side:
I would like to know if anyone had stumble with the same issue and how did you guys fixed it ;)