mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
ac47e9d88a
#bug #refactor #implement #story[1118]
27 lines
575 B
Java
27 lines
575 B
Java
package seng302.gameServer.messages;
|
|
|
|
public class Heartbeat extends Message {
|
|
private final int MESSAGE_SIZE = 4;
|
|
|
|
/**
|
|
* Heartbeat from the AC35 Streaming data spec
|
|
* @param seqNo Increment every time a message is sent
|
|
*/
|
|
public Heartbeat(int seqNo){
|
|
setHeader(new Header(MessageType.HEARTBEAT, 0x01, (short) getSize()));
|
|
|
|
allocateBuffer();
|
|
writeHeaderToBuffer();
|
|
|
|
putUnsignedInt(seqNo, 4);
|
|
|
|
writeCRC();
|
|
rewind();
|
|
}
|
|
|
|
@Override
|
|
public int getSize() {
|
|
return MESSAGE_SIZE;
|
|
}
|
|
|
|
} |