Class WebSocketServerCommProps

    • Constructor Detail

      • WebSocketServerCommProps

        protected WebSocketServerCommProps()
        Creates the WebSocket server property container without a name. The name must be set in all cases using the setPropertyAtom call.
      • WebSocketServerCommProps

        public WebSocketServerCommProps​(Atom propertyAtom)
        Creates the WebSocket server property container with the specified name. All system-reserved names for components begins with "$".
        Parameters:
        propertyAtom - the name of the component, unique within it's parent.
    • Method Detail

      • getFromPort

        public int getFromPort()
        Gets the starting port for server socket ports for acceptance. The first available free server socket will be used, up to the "end-port" (inclusive).
        Returns:
        The port number, default value is 14000.
      • getEndPort

        public int getEndPort()
        Gets the ending port (inclusive) for server socket ports for acceptance.
        Returns:
        The port number, default value is 16000.
      • setPortRange

        public void setPortRange​(int from,
                                 int end)
        Sets the port range the "from-port" and the "end-port" (inclusive) for server socket ports for acceptance. The first available free server socket will be used.
        Parameters:
        from - the port 1-65535.
        end - the port from-65535.
        Throws:
        java.lang.IllegalArgumentException - For invalid arguments.
      • doMaskFrames

        public boolean doMaskFrames()
        Flag indicating frames sent back and forth should be masked, valid from protocol version 7 or better.
        Returns:
        true masking is enabled, false otherwise.
      • setMaskFrames

        public void setMaskFrames​(boolean on)
        Sets if masking of frames sent back and forth should be masked, valid from protocol version 7 or better.
        Parameters:
        on - true to enable frame masking, false otherwise.
      • getSubProtocols

        public java.lang.String[] getSubProtocols()
        Gets the sub-protocols as a String array.
        Returns:
        An array of sub-protocols, it may be zero in length for no sub-protocols.
      • setSubProtocols

        public void setSubProtocols​(java.lang.String[] subProtocols)
        Sets the sub-protocols from a String array. The array may be empty, i.e. of length zero or null for no sub-protocols.
        Parameters:
        subProtocols - The sub-protocols as a String array.
      • doFailForUnsupportedSubProtocol

        public boolean doFailForUnsupportedSubProtocol()
        Check for fail if sub-protocol is not present.
        Returns:
        true (default) for failure, false to accept any or no sub-protocol.
      • doFailForUnsupportedSubProtocol

        public void doFailForUnsupportedSubProtocol​(boolean doFail)
        Set failure action if sub-protocol is not present.
        Parameters:
        doFail - true for failure as an WebSocketException, false to accept any or no sub-protocol.
      • setCacheParams

        public void setCacheParams​(int minLength,
                                   int maxLength,
                                   int count)
        Sets the parameters for cache: minLength, maxLength, count.
        Parameters:
        minLength - The minimum length for caching, 7 is the smallest value.
        maxLength - The maximum length for caching, normally 80 or so (maximum 1024).
        count - The count should normally be larger than 200 and smaller than 1000 (maximum 2048).
        Throws:
        java.lang.IllegalArgumentException - If arguments are not valid.
      • getCacheParams

        public int[] getCacheParams()
        Gets the cache parameters as 3 integers in an array, param[0] is minLength, param[1] is maxLength, param[2] is count.

        The default values are minLength=7, maxLength=80, count=700 if nothing is specified.

        Returns:
        Array of 3 integer parameters, param[0] is minLength, param[1] is maxLength, param[2] is count.
      • getServerReadMessageTimeout

        public int getServerReadMessageTimeout()
        Gets the maximum reply timeout for a complete message from the server, before the connection is closed. This timeout is used for connection and close exchange of data.
        Returns:
        timeout in milliseconds, default is 20 seconds.
      • setServerReadMessageTimeout

        public void setServerReadMessageTimeout​(int timeout)
        Sets the maximum reply timeout for a complete message from the server, before the connection is closed. This timeout is used for connection and close exchange of data.
        Parameters:
        timeout - timeout in milliseconds, default is 20000, -1 sets an indefinite timeout.
      • isOriginValidated

        public boolean isOriginValidated()
        Checks if the Origin HTTP header field should be validated or not. If the Web Socket is created from a File://page.html then origin is null.
        Returns:
        The validation flag.
      • setValidateOrigin

        public void setValidateOrigin​(boolean validate)
        Sets if the Origin HTTP header field should be validated or not. If the Web Socket is created from a File://page.html then origin is null.
        Parameters:
        validate - The validation flag.