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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidHandles the received ping message event by sending a pong message back to the client.static voidRegisters the DefaultPingResponder with the specified CraftsNet instance.static voidunregister(CraftsNet craftsNet) Unregisters the DefaultPingResponder from the specified CraftsNet instance.
-
Constructor Details
-
DefaultPingResponder
public DefaultPingResponder()
-
-
Method Details
-
handlePing
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
Unregisters the DefaultPingResponder from the specified CraftsNet instance.- Parameters:
craftsNet- The CraftsNet instance from which to unregister the responder.
-
register
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.
-