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

public @Interface EnableWebSocket

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

Add this annotation to an @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();
 	   }

	   @Bean
	   public WebSocketHandler echoWebSocketHandler() {
         return new EchoWebSocketHandler();
     }
 }
 
Author
Rossen Stoyanchev
Since
4.0

Method Summary

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString