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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintGet the error code. 0 indicates success; any other value indicates an error.Get the human-readable error message.intlongGet the user id.booleanCheck whether the user's identity has been verified (authenticated).voidsetErrorCode(int errorCode) Set the error code. 0 indicates success; any other value indicates an error.voidsetErrorMessage(String errorMessage) Set the human-readable error message.voidsetExternalServerId(int externalServerId) voidsetUserId(long userId) Set the user id.voidsetVerifyIdentity(boolean verifyIdentity) Set the identity verification flag.toString()Methods inherited from class BroadcastMessage
getCmdMerge, getData, getOriginalData, setCmdInfo, setCmdMerge, setData, setOriginalDataMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface CommonResponse
hasError, isSuccess, setErrorMethods inherited from interface UserIdentity
bindingUserId, setUserIdentity, verifyIdentity
-
Constructor Details
-
BroadcastUserMessage
public BroadcastUserMessage()
-
-
Method Details
-
getUserId
public long getUserId()Description copied from interface:UserIdentityGet the user id.- Specified by:
getUserIdin interfaceUserIdentity- Returns:
- the user id
-
isVerifyIdentity
public boolean isVerifyIdentity()Description copied from interface:UserIdentityCheck whether the user's identity has been verified (authenticated).- Specified by:
isVerifyIdentityin interfaceUserIdentity- Returns:
trueif the identity is verified
-
getExternalServerId
public int getExternalServerId() -
getErrorCode
public int getErrorCode()Description copied from interface:CommonResponseGet the error code. 0 indicates success; any other value indicates an error.- Specified by:
getErrorCodein interfaceCommonResponse- Returns:
- the error code
-
getErrorMessage
Description copied from interface:CommonResponseGet the human-readable error message.- Specified by:
getErrorMessagein interfaceCommonResponse- Returns:
- the error message, or
nullon success
-
setUserId
public void setUserId(long userId) Description copied from interface:UserIdentitySet the user id.- Specified by:
setUserIdin interfaceUserIdentity- Parameters:
userId- the user id
-
setVerifyIdentity
public void setVerifyIdentity(boolean verifyIdentity) Description copied from interface:UserIdentitySet the identity verification flag.- Specified by:
setVerifyIdentityin interfaceUserIdentity- Parameters:
verifyIdentity-trueif the identity is verified
-
setExternalServerId
public void setExternalServerId(int externalServerId) -
setErrorCode
public void setErrorCode(int errorCode) Description copied from interface:CommonResponseSet the error code. 0 indicates success; any other value indicates an error.- Specified by:
setErrorCodein interfaceCommonResponse- Parameters:
errorCode- the error code
-
setErrorMessage
Description copied from interface:CommonResponseSet the human-readable error message.- Specified by:
setErrorMessagein interfaceCommonResponse- Parameters:
errorMessage- the error message
-
toString
- Overrides:
toStringin classBroadcastMessage
-