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 TypeMethodDescriptionbooleancallback(UserSession userSession, IdleEvent event) Heartbeat event callback.default voidpongBefore(CommunicationMessage idleMessage) Callback before heartbeat response (pong).
-
Method Details
-
callback
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- userSessionevent- event- Returns:
- true to disconnect the player
-
pongBefore
Callback before heartbeat response (pong). Developers can add some extra information to the heartbeat message, such as the current time.- Parameters:
idleMessage- idleMessage
-