Class WebSocketCommProps

All Implemented Interfaces:
EventListener, IGProp<GProp<?>[]>, IPropCnr, Cloneable
Direct Known Subclasses:
TransactionCommProps

public class WebSocketCommProps extends SocketCommProps
This property container contains all properties required for WebSocket communication.
Author:
Christopher Mindus
  • Constructor Details

    • WebSocketCommProps

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

      public WebSocketCommProps(Atom propertyAtom)
      Creates the WebSocket 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 Details

    • getVersion

      public int getVersion()
      Gets the protocol version, either 0 (zero) meaning old key1+key2 or version 7 or better: defaults to 13, i.e. the WebSocket final RFC value.
    • setVersion

      public void setVersion(int version)
      Sets the protocol version, either 0 (zero) meaning old key1+key2 (make sure to set the property setOldProtocolUTF8TextOnly(true) if text frames are only supported with old format 0x00 data 0xFF), or version 6 or better.
      Parameters:
      version - A version number: either zero for "old" text-based communication, or a higher version number that also supports binary format.
    • getRequestURI

      public String getRequestURI()
      Gets the request URI.
      Returns:
      The request URI, null if not specified.
    • setRequestURI

      public void setRequestURI(String uri)
      Sets the request URI.
      Parameters:
      uri - The request URI.
    • getSubProtocols

      public 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(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.
    • 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.