引入webSocket测试连接成功,后续在此基础上修改
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -140,6 +140,9 @@ security:
|
||||
# 扫码枪获取出入库单详情
|
||||
- /wms/stockIoDetail
|
||||
- /wms/stockIo/scanInStock
|
||||
# WebSocket路径
|
||||
- /websocket/**
|
||||
- /wms/websocket/**
|
||||
|
||||
|
||||
# MyBatisPlus配置
|
||||
|
||||
Reference in New Issue
Block a user