引入webSocket测试连接成功,后续在此基础上修改

This commit is contained in:
2025-07-29 16:06:38 +08:00
parent b0a7a76518
commit ceda60e919
9 changed files with 635 additions and 2 deletions

View File

@@ -0,0 +1,32 @@
package com.klp.web.controller.websocket;
import com.klp.common.core.controller.BaseController;
import com.klp.common.core.domain.R;
import org.springframework.web.bind.annotation.*;
/**
* WebSocket测试控制器
*
* @author klp
*/
@RestController
@RequestMapping("/websocket/test")
public class WebSocketTestController extends BaseController {
/**
* 测试WebSocket端点是否可用
*/
@GetMapping("/status")
public R<String> getWebSocketStatus() {
return R.ok("WebSocket端点可用连接地址: ws://localhost:8080/websocket/message");
}
/**
* 获取当前连接数
*/
@GetMapping("/connections")
public R<Integer> getConnectionCount() {
// 这里可以调用WebSocketUsers.getUsers().size()来获取实际连接数
return R.ok(0);
}
}

View File

@@ -140,6 +140,9 @@ security:
# 扫码枪获取出入库单详情
- /wms/stockIoDetail
- /wms/stockIo/scanInStock
# WebSocket路径
- /websocket/**
- /wms/websocket/**
# MyBatisPlus配置