Class ServerMessage

java.lang.Object
com.iohao.net.framework.protocol.ServerMessage
Direct Known Subclasses:
ConnectResponseMessage, ServerRequestMessage

public sealed class ServerMessage extends Object permits ServerRequestMessage, ConnectResponseMessage
Sealed base class for server registration and connection messages exchanged with the center server.

Carries the server's identity (id, name, tag), network coordinates (ip, netId, pubName), server type, the set of command routes it handles (cmdMerges), and an extensible payload map. Permitted subclasses: ServerRequestMessage for registration requests and ConnectResponseMessage for connection responses.

Since:
25.1
Author:
渔民小镇
date:
2025-09-05
  • Constructor Details

    • ServerMessage

      public ServerMessage()
  • Method Details

    • addPayload

      public void addPayload(String name, byte[] data)
      Store a payload entry by name.
      Parameters:
      name - the payload key
      data - the payload byte array
    • getPayload

      public byte[] getPayload(String name)
      Retrieve a payload entry by name.
      Parameters:
      name - the payload key
      Returns:
      the payload byte array, or null if not present