Class SocketUserSession
java.lang.Object
com.iohao.net.external.core.netty.session.SocketUserSession
- All Implemented Interfaces:
AttrOptionDynamic, UserSession
Netty channel-backed implementation of an external user session.
- Author:
- 渔民小镇
- date:
- 2023-02-18
-
Method Summary
Modifier and TypeMethodDescriptionvoidemploy(CommunicationMessage message) Adds user info to request.booleangetIp()Get the client IP address.inthashCode()booleanisActive()Check whether the session is active.booleanChecks if the identity has been verified.voidsetBindingLogicServerIds(int[] bindingLogicServerIds) Set logic server bindings associated with this session.voidsetUserId(long userId) Mark the session as identity-verified when the business user id is assigned.io.netty.channel.ChannelFuturewriteAndFlush(Object message) Write a message to the client and flush immediately.Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface AttrOptionDynamic
getOptions, ifNull, ifPresent, option, option, optionValueMethods inherited from interface UserSession
getBindingLogicServerIds, getState, getUserChannelId, getUserId, ofMessage, setAttachment, setExternalJoin
-
Method Details
-
isActive
public boolean isActive()Description copied from interface:UserSessionCheck whether the session is active.- Specified by:
isActivein interfaceUserSession- Returns:
- true if the session is active
-
writeAndFlush
Description copied from interface:UserSessionWrite a message to the client and flush immediately.- Parameters:
message- message object- Returns:
- transport-specific future or write result
-
getIp
-
employ
Description copied from interface:UserSessionAdds user info to request. Developers can extend data via HeadMetadata.setAttachmentData(byte[]), which will be forwarded to the logic server.- Specified by:
employin interfaceUserSession- Parameters:
message- outbound message to enrich with session identity/attachment data
-
setUserId
public void setUserId(long userId) Mark the session as identity-verified when the business user id is assigned.- Specified by:
setUserIdin interfaceUserSession- Parameters:
userId- business user id
-
setBindingLogicServerIds
public void setBindingLogicServerIds(int[] bindingLogicServerIds) Description copied from interface:UserSessionSet logic server bindings associated with this session.- Specified by:
setBindingLogicServerIdsin interfaceUserSession- Parameters:
bindingLogicServerIds- bound logic server ids
-
isVerifyIdentity
public boolean isVerifyIdentity()Description copied from interface:UserSessionChecks if the identity has been verified.- Specified by:
isVerifyIdentityin interfaceUserSession- Returns:
- true if logged in
-
equals
-
hashCode
-