Top Description Methods
org.springframework.web.socket.config.annotation

public @Interface EnableWebSocketMessageBroker

extends Annotation
Annotations
@Retention:RUNTIME
@Target:TYPE
@Documented
@Import:DelegatingWebSocketMessageBrokerConfiguration
Imports
java.lang.annotation.Documented, .ElementType, .Retention, .RetentionPolicy, .Target, org.springframework.context.annotation.Import

Add this annotation to an @Configuration class to enable broker-backed messaging over WebSocket using a higher-level messaging sub-protocol.
@Configuration
@EnableWebSocketMessageBroker
public class MyWebSocketConfig {

}

Customize the imported configuration by implementing the WebSocketMessageBrokerConfigurer interface:

@Configuration
@EnableWebSocketMessageBroker
public class MyConfiguration implements WebSocketMessageBrokerConfigurer {

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

    @Override
    public void configureMessageBroker(MessageBrokerRegistry registry) {
        registry.enableStompBrokerRelay("/queue/", "/topic/");
        registry.setApplicationDestinationPrefixes("/app/");
    }
}
Author
Rossen Stoyanchev
Since
4.0

Method Summary

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString