What is setApplicationDestinationPrefixes used for?

I followed a tutorial on implementing web sockets in a Java Spring application. It has been working fine so far, but I really would like to understand what it is used for:

config.setApplicationDestinationPrefixes("/app");

My whole configuration looks like

@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {

  @Override
  public void configureMessageBroker(MessageBrokerRegistry config) {
    config.enableSimpleBroker("/topic");
    config.setApplicationDestinationPrefixes("/app");
  }

  @Override
  public void registerStompEndpoints(StompEndpointRegistry registry) {
    registry.addEndpoint("/hello").withSockJS();
  }
}

Basically, I just don't understand these explanations in Spring docs / tut - for example.

... it denotes the prefix "/ app" for messages bound to @ MessageMapping-annotated methods.

+4
source share
1 answer

setApplicationDestinationPrefixes STOMP. , STOMP @MessageMapping ( "" ), stompClient.send( "/app/add"..)

0

All Articles