Package com.ultikits.ultitools.websocket
Interface WebSocketMessageHandler
- All Known Implementing Classes:
CommandExecutionHandler,FileOperationHandler,LogStreamHandler,PongHandler,ServerStatusHandler
public interface WebSocketMessageHandler
Interface for handling specific types of WebSocket messages.
Implementations should be registered with MessageHandlerRegistry.
处理特定类型 WebSocket 消息的接口。 实现应注册到 MessageHandlerRegistry。
- Since:
- 6.2.0
- Version:
- 1.0.0
- Author:
- wisdomme
-
Method Summary
Modifier and TypeMethodDescriptionGets the message type this handler processes.default intGets the priority of this handler (higher values = higher priority).voidhandle(com.google.gson.JsonObject message) Handles the incoming message.
-
Method Details
-
getMessageType
String getMessageType()Gets the message type this handler processes. 获取此处理器处理的消息类型。- Returns:
- the message type string (e.g., "pong", "server_status")
-
handle
void handle(com.google.gson.JsonObject message) Handles the incoming message. 处理传入的消息。- Parameters:
message- the JSON message to handle
-
getPriority
default int getPriority()Gets the priority of this handler (higher values = higher priority). Handlers with higher priority are executed first if multiple handlers match the same message type. 获取此处理器的优先级(值越高优先级越高)。 如果多个处理器匹配相同的消息类型,优先级高的先执行。- Returns:
- the priority (default is 0)
-