ai-robot-channel/src/main/java/com/wecom/robot/config/WebSocketConfig.java

25 lines
864 B
Java
Raw Normal View History

2026-02-23 01:45:23 +00:00
package com.wecom.robot.config;
import com.wecom.robot.websocket.CsWebSocketHandler;
import org.springframework.context.annotation.Configuration;
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
@EnableWebSocket
public class WebSocketConfig implements WebSocketConfigurer {
private final CsWebSocketHandler csWebSocketHandler;
public WebSocketConfig(CsWebSocketHandler csWebSocketHandler) {
this.csWebSocketHandler = csWebSocketHandler;
}
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
registry.addHandler(csWebSocketHandler, "/ws/cs/*")
.setAllowedOrigins("*");
}
}