Class SocketUserManager


  • @ApplicationScoped
    public class SocketUserManager
    extends Object

    This web socket user manager holds all web socket users registered by <o:socket>.

    Since:
    2.3
    Author:
    Bauke Scholtz
    See Also:
    Socket
    • Constructor Detail

      • SocketUserManager

        public SocketUserManager()
    • Method Detail

      • register

        protected void register​(Serializable user,
                                String userId)
        Register application user based on given user and session based user ID.
        Parameters:
        user - The user.
        userId - The session based user ID.
      • addChannelId

        protected void addChannelId​(String userId,
                                    String channel,
                                    String channelId)
        Add user channel ID associated with given session based user ID and channel name.
        Parameters:
        userId - The session based user ID.
        channel - The channel name.
        channelId - The channel identifier.
      • getUser

        protected Serializable getUser​(String channel,
                                       String channelId)
        Resolve the user associated with given channel name and ID.
        Parameters:
        channel - The channel name.
        channelId - The channel identifier.
        Returns:
        The user associated with given channel name and ID.
      • getChannelIds

        protected Set<String> getChannelIds​(Serializable user,
                                            String channel)
        Resolve the user-specific channel IDs associated with given user and channel name.
        Parameters:
        user - The user.
        channel - The channel name.
        Returns:
        The user-specific channel IDs associated with given user and channel name.
      • deregister

        protected void deregister​(Serializable user,
                                  String userId)
        Deregister application user associated with given user and session based user ID.
        Parameters:
        user - The user.
        userId - The session based user ID.
      • getUserChannels

        protected ConcurrentHashMap<String,​ConcurrentHashMap<String,​Set<String>>> getUserChannels()
        For internal usage only. This makes it possible to save and restore user specific channels during server restart/failover in SocketChannelManager. This should actually be package private, but package private methods in CDI beans are subject to memory leaks.
        Returns:
        User specific channels.