Contents
Interface ConnectionHandler
- All Known Implementing Classes:
AssetEditorPacketHandler, AuthenticationPacketHandler, GamePacketHandler, GenericConnectionPacketHandler, GenericPacketHandler, HandshakeHandler, InitialPacketHandler, PacketHandler, PasswordPacketHandler, PendingStreamConnectionHandler, SetupPacketHandler, VoiceStreamHandler
public interface ConnectionHandler
Interface for a connection-level packet handler that transports can invoke.
Implemented by
PacketHandler in CoreServer.-
Method Summary
Modifier and TypeMethodDescriptionvoidclosed(NetworkChannel networkChannel) Called when the affiliated network channel has been closed.voidhandle(ToServerPacket packet) Called to handle the given incoming packet.default booleanhandlesPacket(int packetId) Tests if this handler accepts packets with the given ID in its current state.voidCalled to log that this handler's connection has been closed.voidregistered(ConnectionHandler oldHandler) Called when this handler is registered on a connection, potentially replacing an old handler.voidunregistered(ConnectionHandler newHandler) Called when this handler is unregistered from a connection, potentially being replaced by a new handler.
-
Method Details
-
handle
Called to handle the given incoming packet.- Parameters:
packet- The packet to be handled
-
handlesPacket
default boolean handlesPacket(int packetId) Tests if this handler accepts packets with the given ID in its current state. Transports call this when the frame header arrives, before they buffer or decompress the payload, and close the connection if it returnsfalse.- Parameters:
packetId- The ID of the received packet
-
closed
Called when the affiliated network channel has been closed.- Parameters:
networkChannel- The network channel that was closed, or null if unknown
-
logCloseMessage
void logCloseMessage()Called to log that this handler's connection has been closed. -
registered
Called when this handler is registered on a connection, potentially replacing an old handler.- Parameters:
oldHandler- The previous handler, or null if this is the first handler
-
unregistered
Called when this handler is unregistered from a connection, potentially being replaced by a new handler.- Parameters:
newHandler- The new handler replacing this one, or null
-