spring-guides/gs-messaging-stomp-websocket — pull request #6 by rstoyanchev (2013-12-12 18:00:22+00:00)
Title: Simplify greeting method

The controller has been simplified significantly. I've replaced use of the messaging template in favor of a return value.

The flow is as follows .. index.html sends greeting to "/app/greetings", which is handled by the controller's method mapped to "/greetings" (the "/app" prefix removed for mapping purposes). The new greeting returned from the controller method is sent to "/topic/greetings" (same destination with "/topic" pre-pended by default).

Note that we could have used @SendTo to specify the exact destination for the broadcast but this works and is actually intended to work that way. In other words: the client sends a message, the server application enriches, and it broadcasts it. The logical destination is "/greetings" with "/app" and "/topic" helping to route messages accordingly.