Class BroadcastUserMessage

java.lang.Object
com.iohao.net.framework.protocol.BroadcastMessage
com.iohao.net.framework.protocol.BroadcastUserMessage
All Implemented Interfaces:
CommonResponse, UserIdentity

public final class BroadcastUserMessage extends BroadcastMessage implements UserIdentity, CommonResponse
Broadcast message targeting a single user (unicast).

Extends BroadcastMessage with UserIdentity for user binding and CommonResponse for error propagation. Used to push data to one specific connected user identified by userId, routed through the external server identified by externalServerId.

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

    • BroadcastUserMessage

      public BroadcastUserMessage()
  • Method Details

    • getUserId

      public long getUserId()
      Description copied from interface: UserIdentity
      Get the user id.
      Specified by:
      getUserId in interface UserIdentity
      Returns:
      the user id
    • isVerifyIdentity

      public boolean isVerifyIdentity()
      Description copied from interface: UserIdentity
      Check whether the user's identity has been verified (authenticated).
      Specified by:
      isVerifyIdentity in interface UserIdentity
      Returns:
      true if the identity is verified
    • getExternalServerId

      public int getExternalServerId()
    • getErrorCode

      public int getErrorCode()
      Description copied from interface: CommonResponse
      Get the error code. 0 indicates success; any other value indicates an error.
      Specified by:
      getErrorCode in interface CommonResponse
      Returns:
      the error code
    • getErrorMessage

      public String getErrorMessage()
      Description copied from interface: CommonResponse
      Get the human-readable error message.
      Specified by:
      getErrorMessage in interface CommonResponse
      Returns:
      the error message, or null on success
    • setUserId

      public void setUserId(long userId)
      Description copied from interface: UserIdentity
      Set the user id.
      Specified by:
      setUserId in interface UserIdentity
      Parameters:
      userId - the user id
    • setVerifyIdentity

      public void setVerifyIdentity(boolean verifyIdentity)
      Description copied from interface: UserIdentity
      Set the identity verification flag.
      Specified by:
      setVerifyIdentity in interface UserIdentity
      Parameters:
      verifyIdentity - true if the identity is verified
    • setExternalServerId

      public void setExternalServerId(int externalServerId)
    • setErrorCode

      public void setErrorCode(int errorCode)
      Description copied from interface: CommonResponse
      Set the error code. 0 indicates success; any other value indicates an error.
      Specified by:
      setErrorCode in interface CommonResponse
      Parameters:
      errorCode - the error code
    • setErrorMessage

      public void setErrorMessage(String errorMessage)
      Description copied from interface: CommonResponse
      Set the human-readable error message.
      Specified by:
      setErrorMessage in interface CommonResponse
      Parameters:
      errorMessage - the error message
    • toString

      public String toString()
      Overrides:
      toString in class BroadcastMessage