IntelligentRecognition/ah-jjsp-service/.svn/pristine/b1/b1c0d10697370cbf86b3053b9aa...

34 lines
995 B
Plaintext
Raw Normal View History

2024-05-24 16:09:40 +08:00
package com.sercurityControl.proteam.monitor.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
* @author cw chen
* @description websocket消息推送
* @date 2023-04-25 10:10
*/
@Component //1.主要用于标记配置类兼备Component的效果。
@EnableScheduling // 2.开启定时任务
public class WebSocketInfoPush {
private static final Logger log = LoggerFactory.getLogger(WebSocketInfoPush.class);
/**
* 创建websocket发送到前端通知事件
*
* @param
*/
@Async("testTaskExecutor")
// @Scheduled(cron = "0/60 * * * * ?")
public void deviceUpDownToJs() {
log.info("发送前端通知");
NoticeWebsocket.sendMessage("来自WebSocket的消息");
}
}