Class WsWebSocketContainer

    • Constructor Detail

      • WsWebSocketContainer

        public WsWebSocketContainer()
        Default constructor.
    • Method Detail

      • getInstanceManager

        protected InstanceManager getInstanceManager​(java.lang.ClassLoader classLoader)
        Returns the instance manager for the given class loader.
        Parameters:
        classLoader - the class loader
        Returns:
        the instance manager
      • setInstanceManager

        protected void setInstanceManager​(InstanceManager instanceManager)
        Sets the instance manager for this container.
        Parameters:
        instanceManager - the instance manager
      • connectToServer

        public Session connectToServer​(java.lang.Object pojo,
                                       java.net.URI path)
                                throws DeploymentException
        Description copied from interface: jakarta.websocket.WebSocketContainer
        Creates a new connection to the WebSocket server endpoint.
        Specified by:
        connectToServer in interface WebSocketContainer
        Parameters:
        pojo - The POJO endpoint instance that will handle responses from the server
        path - The full URL of the WebSocket endpoint to connect to
        Returns:
        The WebSocket session for the connection
        Throws:
        DeploymentException - If the connection cannot be established
      • connectToServer

        public Session connectToServer​(java.lang.Class<?> annotatedEndpointClass,
                                       java.net.URI path)
                                throws DeploymentException
        Description copied from interface: jakarta.websocket.WebSocketContainer
        Creates a new connection to the WebSocket server endpoint.
        Specified by:
        connectToServer in interface WebSocketContainer
        Parameters:
        annotatedEndpointClass - The annotated endpoint class. An instance of this class will be created to handle responses from the server
        path - The full URL of the WebSocket endpoint to connect to
        Returns:
        The WebSocket session for the connection
        Throws:
        DeploymentException - If the connection cannot be established
      • connectToServer

        public Session connectToServer​(java.lang.Class<? extends Endpoint> clazz,
                                       ClientEndpointConfig clientEndpointConfiguration,
                                       java.net.URI path)
                                throws DeploymentException
        Description copied from interface: jakarta.websocket.WebSocketContainer
        Creates a new connection to the WebSocket.
        Specified by:
        connectToServer in interface WebSocketContainer
        Parameters:
        clazz - An instance of this class will be created to handle responses from the server
        clientEndpointConfiguration - Used to configure the new connection
        path - The full URL of the WebSocket endpoint to connect to
        Returns:
        The WebSocket session for the connection
        Throws:
        DeploymentException - If the connection cannot be established
      • registerSession

        protected void registerSession​(java.lang.Object key,
                                       WsSession wsSession)
        Registers a WebSocket session.
        Parameters:
        key - the session key
        wsSession - the session to register
      • unregisterSession

        protected void unregisterSession​(java.lang.Object key,
                                         WsSession wsSession)
        Unregisters a WebSocket session.
        Parameters:
        key - the session key
        wsSession - the session to unregister
      • getInstalledExtensions

        public java.util.Set<Extension> getInstalledExtensions()
        Get the installed extensions. Currently, this implementation does not support any extensions.
        Specified by:
        getInstalledExtensions in interface WebSocketContainer
        Returns:
        The set of extensions that are supported by this WebSocket implementation.
      • getDefaultAsyncSendTimeout

        public long getDefaultAsyncSendTimeout()
        Get the default timeout for sending a message asynchronously. The default value for this implementation is -1.
        Specified by:
        getDefaultAsyncSendTimeout in interface WebSocketContainer
        Returns:
        The current default timeout in milliseconds. A non-positive value means an infinite timeout.
      • setAsyncSendTimeout

        public void setAsyncSendTimeout​(long timeout)
        Set the default timeout for sending a message asynchronously. The default value for this implementation is -1.
        Specified by:
        setAsyncSendTimeout in interface WebSocketContainer
        Parameters:
        timeout - The new default timeout in milliseconds. A non-positive value means an infinite timeout.
      • destroy

        public void destroy()
        Cleans up the resources still in use by WebSocket sessions created from this container. This includes closing sessions and cancelling Futures associated with blocking read/writes.
      • getProcessPeriod

        public int getProcessPeriod()
        The default value is 10 which means session expirations are processed every 10 seconds.
        Specified by:
        getProcessPeriod in interface BackgroundProcess