content: package me.flyray.rbac.controller.websocket;
  
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.web.servlet.config.annotation.EnableWebMvc;
  import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
  import org.springframework.web.socket.config.annotation.EnableWebSocket;
  import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
  import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
  import org.springframework.web.socket.handler.TextWebSocketHandler;
  
  /** 
  * @author: bolei
  * @date：2017年10月19日 下午12:15:44
  * @description：类说明 
  */
  
  @Configuration
  @EnableWebMvc
  @EnableWebSocket
  public class SpringWebSocketConfig extends WebMvcConfigurerAdapter implements WebSocketConfigurer {
      public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
          registry.addHandler(webSocketHandler(),"/websocket/socketServer").addInterceptors(new SpringWebSocketHandlerInterceptor());
          registry.addHandler(webSocketHandler(), "/sockjs/socketServer").addInterceptors(new SpringWebSocketHandlerInterceptor()).withSockJS();
      }
   
      @Bean
      public TextWebSocketHandler webSocketHandler(){
          return new SpringWebSocketHandler();
      }
  
  }
  