提交 527007f7 编写于 作者: JEECG低代码平台's avatar JEECG低代码平台

websocket会自动断开,断开时,发送通知公告无法推送 #457

上级 6c3c24fe
......@@ -13,6 +13,8 @@ import javax.websocket.server.ServerEndpoint;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
@Component
......@@ -48,7 +50,11 @@ public class WebSocket {
@OnMessage
public void onMessage(String message) {
log.info("【websocket消息】收到客户端消息:"+message);
//log.info("【websocket消息】收到客户端消息:"+message);
JSONObject obj = new JSONObject();
obj.put("cmd", "heartcheck");//业务类型
obj.put("msgTxt", "心跳响应");//消息内容
session.getAsyncRemote().sendText(obj.toJSONString());
}
// 此为广播消息
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册