Is the following Spring web socket configuration legal?
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
config.enableSimpleBroker("/topic");
config.setApplicationDestinationPrefixes("/topic" );
}
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/stomp");
}
}
What I want to achieve is to intercept topic subscriptions in my @Controller
through @SubscribeMapping
. However, for this I need the prefix to /topic
be defined as the application prefix. Reading the documentation and the JavaDoc gives the impression that this is incorrect (either the message must be processed by a broker or by application handlers). However, it works ... hence the question of whether this is a legal configuration.
source
share