Is the following Spring's web socket configuration legal?
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
config.enableSimpleBroker("/topic");
config.setApplicationDestinationPrefixes("/topic" /* same as broker prefix */);
}
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/stomp");
}
}
What I want to achieve is to be able to intercept topic subscriptions in my @Controller
via @SubscribeMapping
. However for that to work I need the /topic
prefix define as application destination prefix. Reading the documentation and JavaDoc gives me impression that this is not correct (either the message is supposed to be handled by the broker, or by application handlers). Nevertheless it works... hence the question whether it is a legal configuration.