You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
1008 B
29 lines
1008 B
package com.platform.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.WebSocketHandler;
|
|
import org.springframework.web.socket.config.annotation.EnableWebSocket;
|
|
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
|
|
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
|
|
|
|
|
|
@Configuration
|
|
@EnableWebMvc
|
|
@EnableWebSocket
|
|
public class WebSocketConfig extends WebMvcConfigurerAdapter implements WebSocketConfigurer {
|
|
|
|
@Override
|
|
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
|
|
// TODO Auto-generated method stub
|
|
registry.addHandler(myHandler(), "/webSocketServer");
|
|
}
|
|
|
|
@Bean
|
|
public WebSocketHandler myHandler() {
|
|
return new SystemWebSocketHandler();
|
|
}
|
|
}
|