mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-09-29 16:06:36 +08:00
init
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package com.admin.config;
|
||||
|
||||
import com.admin.common.utils.WebSocketServer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
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;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@Configuration
|
||||
@EnableWebSocket
|
||||
public class WebSocketConfig implements WebSocketConfigurer {
|
||||
|
||||
@Resource
|
||||
private WebSocketInterceptor webSocketInterceptor;
|
||||
|
||||
|
||||
@Override
|
||||
public void registerWebSocketHandlers(WebSocketHandlerRegistry webSocketHandlerRegistry) {
|
||||
webSocketHandlerRegistry
|
||||
.addHandler(myHandler(), "/system-info")
|
||||
.setAllowedOrigins("*")
|
||||
.addInterceptors(webSocketInterceptor);
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public WebSocketHandler myHandler() {
|
||||
return new WebSocketServer();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user