You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
607 B
19 lines
607 B
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 push(String type, Object data) {
|
|
WebsocketResult websocketResult = new WebsocketResult();
|
|
websocketResult.setType(type);
|
|
websocketResult.setData(data);
|
|
WebSocketServer.sendMessageToClients(JSONUtil.toJsonStr(websocketResult));
|
|
}
|
|
|
|
}
|