Class SocketUserSession

java.lang.Object
com.iohao.net.external.core.netty.session.SocketUserSession
All Implemented Interfaces:
AttrOptionDynamic, UserSession

public final class SocketUserSession extends Object
Netty channel-backed implementation of an external user session.
Author:
渔民小镇
date:
2023-02-18
  • Method Details

    • isActive

      public boolean isActive()
      Description copied from interface: UserSession
      Check whether the session is active.
      Specified by:
      isActive in interface UserSession
      Returns:
      true if the session is active
    • writeAndFlush

      public io.netty.channel.ChannelFuture writeAndFlush(Object message)
      Description copied from interface: UserSession
      Write a message to the client and flush immediately.
      Parameters:
      message - message object
      Returns:
      transport-specific future or write result
    • getIp

      public String getIp()
      Description copied from interface: UserSession
      Get the client IP address.
      Returns:
      player IP
    • employ

      public void employ(CommunicationMessage message)
      Description copied from interface: UserSession
      Adds user info to request. Developers can extend data via HeadMetadata.setAttachmentData(byte[]), which will be forwarded to the logic server.
      Specified by:
      employ in interface UserSession
      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:
      setUserId in interface UserSession
      Parameters:
      userId - business user id
    • setBindingLogicServerIds

      public void setBindingLogicServerIds(int[] bindingLogicServerIds)
      Description copied from interface: UserSession
      Set logic server bindings associated with this session.
      Specified by:
      setBindingLogicServerIds in interface UserSession
      Parameters:
      bindingLogicServerIds - bound logic server ids
    • isVerifyIdentity

      public boolean isVerifyIdentity()
      Description copied from interface: UserSession
      Checks if the identity has been verified.
      Specified by:
      isVerifyIdentity in interface UserSession
      Returns:
      true if logged in
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object