Message types and server (#44)

* message type and handling

* deleted web-content and fixed bug

* edited main page
This commit is contained in:
Valentin Heiserer
2024-04-23 21:54:31 +02:00
committed by GitHub
parent cab2d36f48
commit a0a1cfaa4a
79 changed files with 1737 additions and 637 deletions

View File

@@ -2,9 +2,13 @@ package org.schafkopf;
import java.util.Timer;
import java.util.TimerTask;
import org.schafkopf.SchafkopfMessage.SchafkopfBaseMessage;
/** Creates an Instance of the Backend Server. */
/**
* Creates an Instance of the Backend Server.
*/
public class HeartbeatSender {
private static final int HEARTBEAT_INTERVAL = 15000; // 1 minute
private final DedicatedServerConnection client;
@@ -13,13 +17,16 @@ public class HeartbeatSender {
this.client = client;
}
/** Creates an Instance of the Backend Server. */
/**
* Creates an Instance of the Backend Server.
*/
public void start() {
Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
client.sendMessage("HEARTBEAT SYN"); // Send a heartbeat message
client.sendMessage(
new SchafkopfBaseMessage(SchafkopfMessage.SchafkopfMessageType.HEARTBEAT_SYN));
}
}, HEARTBEAT_INTERVAL, HEARTBEAT_INTERVAL);
}