石墨消解仪后端服务
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.

18 lines
557 B

3 months ago
3 months ago
3 months ago
  1. package com.iflytop.gd.app.service;
  2. import cn.hutool.json.JSONUtil;
  3. import com.iflytop.gd.infrastructure.config.WebSocketServer;
  4. import com.iflytop.gd.app.model.dto.WebsocketResult;
  5. import org.springframework.stereotype.Service;
  6. @Service
  7. public class WebSocketService {
  8. public void push(String type, Object data) {
  9. WebsocketResult websocketResult = new WebsocketResult();
  10. websocketResult.setType(type);
  11. websocketResult.setData(data);
  12. WebSocketServer.sendMessageToClients(JSONUtil.toJsonStr(websocketResult));
  13. }
  14. }