tcp服务启动

This commit is contained in:
zc
2026-03-12 19:45:07 +08:00
parent 7d48c78c9b
commit d9f808ecc1
14 changed files with 32 additions and 1222 deletions

View File

@@ -1,25 +1,18 @@
package top.wms.admin.config.webSocket;
import org.springframework.beans.factory.annotation.Autowired;
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;
import top.wms.admin.controller.hkMVS.CameraWebSocketHandler;
import top.wms.admin.controller.weighManage.ah.ScaleWebSocketHandler;
@Configuration
@EnableWebSocket
public class WebSocketConfig implements WebSocketConfigurer {
@Autowired
private CameraWebSocketHandler cameraWebSocketHandler;
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
// 注册WebSocket端点允许所有跨域请求
registry.addHandler(new ScaleWebSocketHandler(), "/ws/scale").setAllowedOrigins("*");
// 注册海康相机1 WebSocket端点
registry.addHandler(cameraWebSocketHandler, "/ws/camera").setAllowedOrigins("*");
}
}