Interface NetworkChannelHandler


public interface NetworkChannelHandler
A handler for operations performed on a channel.
Since:
4.0
  • Method Details

    • handleChannelInitialize

      void handleChannelInitialize(@NonNull @NonNull NetworkChannel channel) throws Exception
      Handles the initialization of the channel, called the first time when a channel becomes active.
      Parameters:
      channel - the channel which was opened and to which this handler is bound.
      Throws:
      NullPointerException - if the given channel is null.
      Exception - if any exception occurs during the event processing.
    • handlePacketReceive

      boolean handlePacketReceive(@NonNull @NonNull NetworkChannel channel, @NonNull @NonNull Packet packet) throws Exception
      Handles the receive of a packet on the channel this handler is bound to.
      Parameters:
      channel - the channel to which the packet was sent and the handler is bound.
      packet - the packet which was received.
      Returns:
      true if the packet should get processed by the packet registry, false otherwise.
      Throws:
      NullPointerException - if either the given channel or packet is null.
      Exception - if any exception occurs during the event processing.
    • handleChannelClose

      void handleChannelClose(@NonNull @NonNull NetworkChannel channel) throws Exception
      Handles the inactivation processing of a channel, at this point the channel was closed either by a local handler or the remote directly.
      Parameters:
      channel - the channel which was closed and this handler is bound to.
      Throws:
      NullPointerException - if the given channel is null.
      Exception - if any exception occurs during the event processing.