Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
31 lines
925 B
Java
31 lines
925 B
Java
package electrosphere.net.client.protocol;
|
|
|
|
import electrosphere.engine.Globals;
|
|
import electrosphere.net.parser.net.message.ServerMessage;
|
|
import electrosphere.net.template.ClientProtocolTemplate;
|
|
|
|
/**
|
|
* The client protocol for handling server messages
|
|
*/
|
|
public class ServerProtocol implements ClientProtocolTemplate<ServerMessage> {
|
|
|
|
@Override
|
|
public ServerMessage handleAsyncMessage(ServerMessage message) {
|
|
return message;
|
|
}
|
|
|
|
@Override
|
|
public void handleSyncMessage(ServerMessage message) {
|
|
switch(message.getMessageSubtype()){
|
|
case PING:
|
|
Globals.clientConnection.queueOutgoingMessage(ServerMessage.constructPongMessage());
|
|
break;
|
|
case PONG:
|
|
//let the networking loop know we received a pong message
|
|
Globals.clientConnection.markReceivedPongMessage();
|
|
break;
|
|
}
|
|
}
|
|
|
|
}
|