diff --git a/ruoyi-modules/hw-websocket-server/src/main/java/com/hw/websocket/controller/WebSocketApi.java b/ruoyi-modules/hw-websocket-server/src/main/java/com/hw/websocket/controller/WebSocketApi.java index d36358b..45818b7 100644 --- a/ruoyi-modules/hw-websocket-server/src/main/java/com/hw/websocket/controller/WebSocketApi.java +++ b/ruoyi-modules/hw-websocket-server/src/main/java/com/hw/websocket/controller/WebSocketApi.java @@ -2,6 +2,7 @@ package com.hw.websocket.controller; import com.alibaba.fastjson2.JSONObject; import com.hw.websocket.operate.WebSocket; +import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.uuid.UUID; import com.ruoyi.common.core.web.domain.AjaxResult; import org.slf4j.Logger; @@ -31,9 +32,12 @@ public class WebSocketApi { @PostMapping() @ResponseBody public AjaxResult push(String message){ - String info = null; try{ - String[] split = info.split("1"); + if(StringUtils.isEmpty(message)){ + logger.info("WebSocket Api接收数据为空"); + return AjaxResult.error("参数不允许为空"); + } + logger.info("WebSocket Api接收数据:"+message); webSocket.sendAllMessage(message); return AjaxResult.success(); }catch (Exception ex){