java.lang.Object
technology.sola.engine.networking.socket.SocketMessage

@NullMarked public class SocketMessage extends Object
SocketMessage contains data transmitted between a server and client.
  • Constructor Details

    • SocketMessage

      public SocketMessage(int type, String body)
      Creates a new SocketMessage instance. Body must be 65533 bytes or fewer.
      Parameters:
      type - the type of the message
      body - the body of the message
  • Method Details

    • parse

      public static SocketMessage parse(String message)
      Creates a SocketMessage instance from a raw string message.
      Parameters:
      message - the raw message
      Returns:
      the parsed SocketMessage instance
    • getType

      public int getType()
      Returns:
      the type of the message
    • getBody

      public String getBody()
      Returns:
      the body of the message
    • toString

      public String toString()
      Overrides:
      toString in class Object