package com.pqs9300.util;

import com.pqs9300.controller.socket.WebSocketServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author hongawen
 * @date: 2020/8/4 11:51
 */
@Component
public class SocketSender {

    @Resource
    private WebSocketServer socket;

    private static Logger logger = LoggerFactory.getLogger(SocketSender.class);


    /**
     * 往前台发送消息
     */
    public void sendSocketMsg(String msg) {
        try {
            socket.sendMessage("技术监督状态变化:" + msg);
        } catch (Exception e) {
            logger.error("推送socket信息异常，异常为："+e.getMessage());
        }
    }

}
