From c1ce765634d1de1fae0d97cf25cd23b31f3ce1cc Mon Sep 17 00:00:00 2001 From: lgh0010 <1746689524@qq.com> Date: Sat, 19 Mar 2022 22:40:38 +0800 Subject: [PATCH] =?UTF-8?q?websocket=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/mt/wms/empty/task/ScheduledTask.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java index 3f382bf..b1d08fd 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java @@ -9,6 +9,7 @@ import com.mt.wms.core.dal.service.*; import com.mt.wms.core.utils.CodeGeneratorHelper; import com.mt.wms.core.utils.HttpClient; import com.mt.wms.core.vo.R; +import com.mt.wms.empty.websocket.WebSocketServer; import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -61,6 +62,13 @@ public class ScheduledTask extends BaseService { private PointInfoServiceBiz pointInfoServiceBiz; @Resource private RunTaskUtils runTaskUtils; + @Resource + private WebSocketServer webSocketServer; + + @Scheduled(fixedDelay = 5000) + public void testWebsocket() throws IOException { + webSocketServer.sendtoAll(LocalDateTime.now()+"测试"); + } /** * 查询加工完成的窑炉