|
|
@ -3,6 +3,7 @@ package com.hw.websocket.controller;
|
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
|
import com.hw.websocket.operate.WebSocket;
|
|
|
|
import com.hw.websocket.operate.WebSocket;
|
|
|
|
import com.ruoyi.common.core.utils.uuid.UUID;
|
|
|
|
import com.ruoyi.common.core.utils.uuid.UUID;
|
|
|
|
|
|
|
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@ -29,11 +30,15 @@ public class WebSocketApi {
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping()
|
|
|
|
@PostMapping()
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public void push(String message){
|
|
|
|
public AjaxResult push(String message){
|
|
|
|
|
|
|
|
String info = null;
|
|
|
|
try{
|
|
|
|
try{
|
|
|
|
|
|
|
|
String[] split = info.split("1");
|
|
|
|
webSocket.sendAllMessage(message);
|
|
|
|
webSocket.sendAllMessage(message);
|
|
|
|
|
|
|
|
return AjaxResult.success();
|
|
|
|
}catch (Exception ex){
|
|
|
|
}catch (Exception ex){
|
|
|
|
logger.error("WebSocket Api接口异常:"+ex.getMessage());
|
|
|
|
logger.error("WebSocket Api接口异常:"+ex.getMessage());
|
|
|
|
|
|
|
|
return AjaxResult.error(ex.getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|