Class DefaultPingResponder

java.lang.Object
de.craftsblock.craftsnet.api.websocket.DefaultPingResponder
All Implemented Interfaces:
de.craftsblock.craftscore.event.ListenerAdapter

public class DefaultPingResponder extends Object implements de.craftsblock.craftscore.event.ListenerAdapter
A default implementation of a ping responder for handling incoming ping messages. This responder sends a pong message back to the client when a ping message is received.
Since:
3.0.5-SNAPSHOT
See Also:
  • Constructor Details

    • DefaultPingResponder

      public DefaultPingResponder()
  • Method Details

    • handlePing

      public void handlePing(ReceivedPingMessageEvent event)
      Handles the received ping message event by sending a pong message back to the client.
      Parameters:
      event - The event containing the received ping message and the client it originated from.
    • unregister

      public static void unregister(CraftsNet craftsNet)
      Unregisters the DefaultPingResponder from the specified CraftsNet instance.
      Parameters:
      craftsNet - The CraftsNet instance from which to unregister the responder.
    • register

      public static void register(CraftsNet craftsNet)
      Registers the DefaultPingResponder with the specified CraftsNet instance. If the responder is already registered, it is unregistered first before registering again.
      Parameters:
      craftsNet - The CraftsNet instance with which to register the responder.