@Retention(value=RUNTIME) @Target(value=TYPE) @Documented @Import(value=DelegatingWebSocketConfiguration.class) public @interface EnableWebSocket
@Configuration
class to configure
processing WebSocket requests. A typical configuration would look like this:
@Configuration @EnableWebSocket public class MyWebSocketConfig { }
Customize the imported configuration by implementing the
WebSocketConfigurer
interface:
@Configuration @EnableWebSocket public class MyConfiguration implements WebSocketConfigurer { @Override public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { registry.addHandler(echoWebSocketHandler(), "/echo").withSockJS(); } @Override public WebSocketHandler echoWebSocketHandler() { return new EchoWebSocketHandler(); } }