Interface RequestPacketHandler<P extends Packet,R extends Packet,C extends EngineConnection>

Type Parameters:
P - The request packet type
R - The response packet type
C - The connection type
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface RequestPacketHandler<P extends Packet,R extends Packet,C extends EngineConnection>
Represents a packet handler for RequestPackets.
  • Method Details

    • handleRequest

      void handleRequest(P requestPacket, C connection, RequestPacketResponse<R> response)
      Handles the RequestPacket which was send by a specific RemoteConnection. A proper response Packet should be answered with.

      Throwing a ChannelException during the execution of this handler will automatically be applied to the RequestPacketResponse.

      Every handled request should apply the proper response to RequestPacketResponse. Responding doesn't have to be instantly and can be from a concurrent context, but it shouldn't take minutes.

      Parameters:
      requestPacket - The received request packet
      connection - The connection that sent the packet
      response - The response which should be completed