mirror of
https://github.com/Vale54321/schafkopf-bot.git
synced 2025-12-18 12:39:34 +01:00
Message types and server (#44)
* message type and handling * deleted web-content and fixed bug * edited main page
This commit is contained in:
committed by
GitHub
parent
cab2d36f48
commit
a0a1cfaa4a
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user