Class Configuration

java.lang.Object
com.corundumstudio.socketio.Configuration

public class Configuration extends Object
  • Constructor Details

    • Configuration

      public Configuration()
  • Method Details

    • getJsonSupport

      public JsonSupport getJsonSupport()
    • setJsonSupport

      public void setJsonSupport(JsonSupport jsonSupport)
      Allows to setup custom implementation of JSON serialization/deserialization
      Parameters:
      jsonSupport - - json mapper
      See Also:
    • getHostname

      public String getHostname()
    • setHostname

      public void setHostname(String hostname)
      Optional parameter. If not set then bind address will be 0.0.0.0 or ::0
      Parameters:
      hostname - - name of host
    • getPort

      public int getPort()
    • setPort

      public void setPort(int port)
    • getBossThreads

      public int getBossThreads()
    • setBossThreads

      public void setBossThreads(int bossThreads)
    • getWorkerThreads

      public int getWorkerThreads()
    • setWorkerThreads

      public void setWorkerThreads(int workerThreads)
    • setPingInterval

      public void setPingInterval(int heartbeatIntervalSecs)
      Ping interval
      Parameters:
      heartbeatIntervalSecs - - time in milliseconds
    • getPingInterval

      public int getPingInterval()
    • setPingTimeout

      public void setPingTimeout(int heartbeatTimeoutSecs)
      Ping timeout Use 0 to disable it
      Parameters:
      heartbeatTimeoutSecs - - time in milliseconds
    • getPingTimeout

      public int getPingTimeout()
    • isHeartbeatsEnabled

      public boolean isHeartbeatsEnabled()
    • getContext

      public String getContext()
    • setContext

      public void setContext(String context)
    • isAllowCustomRequests

      public boolean isAllowCustomRequests()
    • setAllowCustomRequests

      public void setAllowCustomRequests(boolean allowCustomRequests)
      Allow to service custom requests differs from socket.io protocol. In this case it's necessary to add own handler which handle them to avoid hang connections. Default is false
      Parameters:
      allowCustomRequests - - true to allow
    • setKeyStorePassword

      public void setKeyStorePassword(String keyStorePassword)
      SSL key store password
      Parameters:
      keyStorePassword - - password of key store
    • getKeyStorePassword

      public String getKeyStorePassword()
    • setKeyStore

      public void setKeyStore(InputStream keyStore)
      SSL key store stream, maybe appointed to any source
      Parameters:
      keyStore - - key store input stream
    • getKeyStore

      public InputStream getKeyStore()
    • setKeyStoreFormat

      public void setKeyStoreFormat(String keyStoreFormat)
      Key store format
      Parameters:
      keyStoreFormat - - key store format
    • getKeyStoreFormat

      public String getKeyStoreFormat()
    • setMaxHttpContentLength

      public void setMaxHttpContentLength(int value)
      Set maximum http content length limit
      Parameters:
      value - the maximum length of the aggregated http content.
    • getMaxHttpContentLength

      public int getMaxHttpContentLength()
    • setTransports

      public void setTransports(Transport... transports)
      Transports supported by server
      Parameters:
      transports - - list of transports
    • getTransports

      public List<Transport> getTransports()
    • setPackagePrefix

      public void setPackagePrefix(String packagePrefix)
      Package prefix for sending json-object from client without full class name. With defined package prefix socket.io client just need to define '@class: 'SomeType'' in json object instead of '@class: 'com.full.package.name.SomeType''
      Parameters:
      packagePrefix - - prefix string
    • getPackagePrefix

      public String getPackagePrefix()
    • setPreferDirectBuffer

      public void setPreferDirectBuffer(boolean preferDirectBuffer)
      Buffer allocation method used during packet encoding. Default is true
      Parameters:
      preferDirectBuffer - true if a direct buffer should be tried to be used as target for the encoded messages. If false is used it will allocate a heap buffer, which is backed by an byte array.
    • isPreferDirectBuffer

      public boolean isPreferDirectBuffer()
    • setStoreFactory

      public void setStoreFactory(StoreFactory clientStoreFactory)
      Data store - used to store session data and implements distributed pubsub. Default is MemoryStoreFactory
      Parameters:
      clientStoreFactory - - implements StoreFactory
      See Also:
    • getStoreFactory

      public StoreFactory getStoreFactory()
    • setAuthorizationListener

      public void setAuthorizationListener(AuthorizationListener authorizationListener)
      Authorization listener invoked on every handshake. Accepts or denies a client by AuthorizationListener.isAuthorized method. Accepts all clients by default.
      Parameters:
      authorizationListener - - authorization listener itself
      See Also:
    • getAuthorizationListener

      public AuthorizationListener getAuthorizationListener()
    • setExceptionListener

      public void setExceptionListener(ExceptionListener exceptionListener)
      Exception listener invoked on any exception in SocketIO listener
      Parameters:
      exceptionListener - - listener
      See Also:
    • getExceptionListener

      public ExceptionListener getExceptionListener()
    • getSocketConfig

      public SocketConfig getSocketConfig()
    • setSocketConfig

      public void setSocketConfig(SocketConfig socketConfig)
      TCP socket configuration
      Parameters:
      socketConfig - - config
    • setAckMode

      public void setAckMode(AckMode ackMode)
      Auto ack-response mode Default is AckMode.AUTO_SUCCESS_ONLY
      Parameters:
      ackMode - - ack mode
      See Also:
    • getAckMode

      public AckMode getAckMode()
    • getTrustStoreFormat

      public String getTrustStoreFormat()
    • setTrustStoreFormat

      public void setTrustStoreFormat(String trustStoreFormat)
    • getTrustStore

      public InputStream getTrustStore()
    • setTrustStore

      public void setTrustStore(InputStream trustStore)
    • getTrustStorePassword

      public String getTrustStorePassword()
    • setTrustStorePassword

      public void setTrustStorePassword(String trustStorePassword)
    • getKeyManagerFactoryAlgorithm

      public String getKeyManagerFactoryAlgorithm()
    • setKeyManagerFactoryAlgorithm

      public void setKeyManagerFactoryAlgorithm(String keyManagerFactoryAlgorithm)
    • setMaxFramePayloadLength

      public void setMaxFramePayloadLength(int maxFramePayloadLength)
      Set maximum websocket frame content length limit
      Parameters:
      maxFramePayloadLength - - length
    • getMaxFramePayloadLength

      public int getMaxFramePayloadLength()
    • setUpgradeTimeout

      public void setUpgradeTimeout(int upgradeTimeout)
      Transport upgrade timeout in milliseconds
      Parameters:
      upgradeTimeout - - upgrade timeout
    • getUpgradeTimeout

      public int getUpgradeTimeout()
    • setAddVersionHeader

      public void setAddVersionHeader(boolean addVersionHeader)
      Adds Server header with lib version to http response.

      Default is true

      Parameters:
      addVersionHeader - - true to add header
    • isAddVersionHeader

      public boolean isAddVersionHeader()
    • setOrigin

      public void setOrigin(String origin)
      Set Access-Control-Allow-Origin header value for http each response. Default is null If value is null then request ORIGIN header value used.
      Parameters:
      origin - - origin
    • getOrigin

      public String getOrigin()
    • isUseLinuxNativeEpoll

      public boolean isUseLinuxNativeEpoll()
    • setUseLinuxNativeEpoll

      public void setUseLinuxNativeEpoll(boolean useLinuxNativeEpoll)
    • setSSLProtocol

      public void setSSLProtocol(String sslProtocol)
      Set the name of the requested SSL protocol
      Parameters:
      sslProtocol - - name of protocol
    • getSSLProtocol

      public String getSSLProtocol()
    • setAllowHeaders

      public void setAllowHeaders(String allowHeaders)
      Set the response Access-Control-Allow-Headers
      Parameters:
      allowHeaders - - allow headers
    • getAllowHeaders

      public String getAllowHeaders()
    • setFirstDataTimeout

      public void setFirstDataTimeout(int firstDataTimeout)
      Timeout between channel opening and first data transfer Helps to avoid 'silent channel' attack and prevents 'Too many open files' problem in this case
      Parameters:
      firstDataTimeout - - timeout value
    • getFirstDataTimeout

      public int getFirstDataTimeout()
    • setHttpCompression

      public void setHttpCompression(boolean httpCompression)
      Activate http protocol compression. Uses gzip or deflate encoding choice depends on the "Accept-Encoding" header value.

      Default is true

      Parameters:
      httpCompression - - true to use http compression
    • isHttpCompression

      public boolean isHttpCompression()
    • setWebsocketCompression

      public void setWebsocketCompression(boolean websocketCompression)
      Activate websocket protocol compression. Uses permessage-deflate encoding only.

      Default is true

      Parameters:
      websocketCompression - - true to use websocket compression
    • isWebsocketCompression

      public boolean isWebsocketCompression()
    • isRandomSession

      public boolean isRandomSession()
    • setRandomSession

      public void setRandomSession(boolean randomSession)
    • setNeedClientAuth

      public void setNeedClientAuth(boolean needClientAuth)
      Enable/disable client authentication. Has no effect unless a trust store has been provided. Default is false
      Parameters:
      needClientAuth - - true to use client authentication
    • isNeedClientAuth

      public boolean isNeedClientAuth()