package com.gyee.frame.common.websocket;

import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Component;

/**
 * @descrition:
 * @author:Wanghs
 * @date:2020-08-05
 */
@Component
public class WebsocketMessageService
{

    @Autowired
    private SimpMessagingTemplate simpMessagingTemplate;


    public void SendAlertToAll(String destination, String sendData)
    {
        String s = JSON.toJSONString(sendData);
        System.out.println(s);
        simpMessagingTemplate.convertAndSend(destination, s);
    }
}
