Class DefaultSocketIdleHook

java.lang.Object
com.iohao.net.external.core.netty.hook.DefaultSocketIdleHook
All Implemented Interfaces:
IdleHook<io.netty.handler.timeout.IdleStateEvent>, SocketIdleHook

public final class DefaultSocketIdleHook extends Object implements SocketIdleHook
TCP/WebSocket heartbeat hook
Author:
渔民小镇
date:
2023-02-18
  • Constructor Details

    • DefaultSocketIdleHook

      public DefaultSocketIdleHook()
  • Method Details

    • callback

      public boolean callback(UserSession userSession, io.netty.handler.timeout.IdleStateEvent event)
      Description copied from interface: IdleHook
      Heartbeat event callback.

      You only need to handle your business logic here, such as notifying other players in the room that the user has gone offline.

      Specified by:
      callback in interface IdleHook<io.netty.handler.timeout.IdleStateEvent>
      Parameters:
      userSession - userSession
      event - event
      Returns:
      true to disconnect the player