Merge branch 'master' into docker_package
This commit is contained in:
commit
f997270565
|
@ -101,4 +101,8 @@ public class WebSocketServer {
|
|||
log.error("send message error," + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public static Map<String, WebSocketData> getServers() {
|
||||
return servers;
|
||||
}
|
||||
}
|
|
@ -28,8 +28,14 @@ public class HeartRateTask implements ITask {
|
|||
*/
|
||||
@Override
|
||||
public void run(String params) {
|
||||
logger.info("websocket心跳");
|
||||
MessageData<String> message = new MessageData<String>().msg("heartRate:" + LocalDateTime.now());
|
||||
webSocketServer.sendMessageAll(message);
|
||||
try {
|
||||
if (webSocketServer.getServers().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
MessageData<String> message = new MessageData<String>().msg("heartRate:" + LocalDateTime.now());
|
||||
webSocketServer.sendMessageAll(message);
|
||||
} catch (Exception exception) {
|
||||
logger.error("websocket客户端心跳失败", exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue