send metrics to client when they connect
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 1m56s

This commit is contained in:
Lee 2024-04-20 14:23:43 +01:00
parent b666e5a8b7
commit 543aff2a04

@ -1,6 +1,7 @@
package xyz.mcutils.backend.websocket.impl;
import lombok.extern.log4j.Log4j2;
import org.jetbrains.annotations.NotNull;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import xyz.mcutils.backend.Main;
@ -30,6 +31,11 @@ public class MetricsWebSocket extends WebSocket {
}, interval, interval);
}
@Override
public void afterConnectionEstablished(@NotNull WebSocketSession session) {
sendMetrics(session); // Send metrics to the client when they connect
}
/**
* Sends the metrics to the client.
*