|
|
@ -1,18 +1,19 @@ |
|
|
|
package com.iflytop.gd.system.service; |
|
|
|
|
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
import com.iflytop.gd.app.common.enums.CraftStates; |
|
|
|
import com.iflytop.gd.system.config.WebSocketServer; |
|
|
|
import com.iflytop.gd.system.model.dto.WebsocketResult; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
@Service |
|
|
|
public class WebSocketService { |
|
|
|
public void pushMsg(String type, Object result) { |
|
|
|
|
|
|
|
public void push(String type, Object data) { |
|
|
|
WebsocketResult websocketResult = new WebsocketResult(); |
|
|
|
websocketResult.setType(type); |
|
|
|
websocketResult.setData(result); |
|
|
|
// 发送消息给客户端 |
|
|
|
websocketResult.setData(data); |
|
|
|
WebSocketServer.sendMessageToClients(JSONUtil.toJsonStr(websocketResult)); |
|
|
|
} |
|
|
|
|
|
|
|
} |