Interface IdleHook<IdleEvent>

All Known Subinterfaces:
SocketIdleHook
All Known Implementing Classes:
DefaultSocketIdleHook

public interface IdleHook<IdleEvent>
Heartbeat IdleHook
Author:
渔民小镇
date:
2023-02-18
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    callback(UserSession userSession, IdleEvent event)
    Heartbeat event callback.
    default void
    Callback before heartbeat response (pong).
  • Method Details

    • callback

      boolean callback(UserSession userSession, IdleEvent event)
      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.

      Parameters:
      userSession - userSession
      event - event
      Returns:
      true to disconnect the player
    • pongBefore

      default void pongBefore(CommunicationMessage idleMessage)
      Callback before heartbeat response (pong). Developers can add some extra information to the heartbeat message, such as the current time.
      Parameters:
      idleMessage - idleMessage