Package com.corundumstudio.socketio
Class Configuration
java.lang.Object
com.corundumstudio.socketio.Configuration
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
int
int
int
int
int
int
getPort()
int
int
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
void
setAckMode
(AckMode ackMode) Auto ack-response mode Default isAckMode.AUTO_SUCCESS_ONLY
void
setAddVersionHeader
(boolean addVersionHeader) Adds Server header with lib version to http response.void
setAllowCustomRequests
(boolean allowCustomRequests) Allow to service custom requests differs from socket.io protocol.void
setAllowHeaders
(String allowHeaders) Set the response Access-Control-Allow-Headersvoid
setAuthorizationListener
(AuthorizationListener authorizationListener) Authorization listener invoked on every handshake.void
setBossThreads
(int bossThreads) void
setContext
(String context) void
setExceptionListener
(ExceptionListener exceptionListener) Exception listener invoked on any exception in SocketIO listenervoid
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 casevoid
setHostname
(String hostname) Optional parameter.void
setHttpCompression
(boolean httpCompression) Activate http protocol compression.void
setJsonSupport
(JsonSupport jsonSupport) Allows to setup custom implementation of JSON serialization/deserializationvoid
setKeyManagerFactoryAlgorithm
(String keyManagerFactoryAlgorithm) void
setKeyStore
(InputStream keyStore) SSL key store stream, maybe appointed to any sourcevoid
setKeyStoreFormat
(String keyStoreFormat) Key store formatvoid
setKeyStorePassword
(String keyStorePassword) SSL key store passwordvoid
setMaxFramePayloadLength
(int maxFramePayloadLength) Set maximum websocket frame content length limitvoid
setMaxHttpContentLength
(int value) Set maximum http content length limitvoid
setNeedClientAuth
(boolean needClientAuth) Enable/disable client authentication.void
Set Access-Control-Allow-Origin header value for http each response.void
setPackagePrefix
(String packagePrefix) Package prefix for sending json-object from client without full class name.void
setPingInterval
(int heartbeatIntervalSecs) Ping intervalvoid
setPingTimeout
(int heartbeatTimeoutSecs) Ping timeout Use0
to disable itvoid
setPort
(int port) void
setPreferDirectBuffer
(boolean preferDirectBuffer) Buffer allocation method used during packet encoding.void
setRandomSession
(boolean randomSession) void
setSocketConfig
(SocketConfig socketConfig) TCP socket configurationvoid
setSSLProtocol
(String sslProtocol) Set the name of the requested SSL protocolvoid
setStoreFactory
(StoreFactory clientStoreFactory) Data store - used to store session data and implements distributed pubsub.void
setTransports
(Transport... transports) Transports supported by servervoid
setTrustStore
(InputStream trustStore) void
setTrustStoreFormat
(String trustStoreFormat) void
setTrustStorePassword
(String trustStorePassword) void
setUpgradeTimeout
(int upgradeTimeout) Transport upgrade timeout in millisecondsvoid
setUseLinuxNativeEpoll
(boolean useLinuxNativeEpoll) void
setWebsocketCompression
(boolean websocketCompression) Activate websocket protocol compression.void
setWorkerThreads
(int workerThreads)
-
Constructor Details
-
Configuration
public Configuration()
-
-
Method Details
-
getJsonSupport
-
setJsonSupport
Allows to setup custom implementation of JSON serialization/deserialization- Parameters:
jsonSupport
- - json mapper- See Also:
-
getHostname
-
setHostname
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 Use0
to disable it- Parameters:
heartbeatTimeoutSecs
- - time in milliseconds
-
getPingTimeout
public int getPingTimeout() -
isHeartbeatsEnabled
public boolean isHeartbeatsEnabled() -
getContext
-
setContext
-
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 isfalse
- Parameters:
allowCustomRequests
- -true
to allow
-
setKeyStorePassword
SSL key store password- Parameters:
keyStorePassword
- - password of key store
-
getKeyStorePassword
-
setKeyStore
SSL key store stream, maybe appointed to any source- Parameters:
keyStore
- - key store input stream
-
getKeyStore
-
setKeyStoreFormat
Key store format- Parameters:
keyStoreFormat
- - key store format
-
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
Transports supported by server- Parameters:
transports
- - list of transports
-
getTransports
-
setPackagePrefix
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
-
setPreferDirectBuffer
public void setPreferDirectBuffer(boolean preferDirectBuffer) Buffer allocation method used during packet encoding. Default istrue
- Parameters:
preferDirectBuffer
-true
if a direct buffer should be tried to be used as target for the encoded messages. Iffalse
is used it will allocate a heap buffer, which is backed by an byte array.
-
isPreferDirectBuffer
public boolean isPreferDirectBuffer() -
setStoreFactory
Data store - used to store session data and implements distributed pubsub. Default isMemoryStoreFactory
- Parameters:
clientStoreFactory
- - implements StoreFactory- See Also:
-
getStoreFactory
-
setAuthorizationListener
Authorization listener invoked on every handshake. Accepts or denies a client byAuthorizationListener.isAuthorized
method. Accepts all clients by default.- Parameters:
authorizationListener
- - authorization listener itself- See Also:
-
getAuthorizationListener
-
setExceptionListener
Exception listener invoked on any exception in SocketIO listener- Parameters:
exceptionListener
- - listener- See Also:
-
getExceptionListener
-
getSocketConfig
-
setSocketConfig
TCP socket configuration- Parameters:
socketConfig
- - config
-
setAckMode
Auto ack-response mode Default isAckMode.AUTO_SUCCESS_ONLY
- Parameters:
ackMode
- - ack mode- See Also:
-
getAckMode
-
getTrustStoreFormat
-
setTrustStoreFormat
-
getTrustStore
-
setTrustStore
-
getTrustStorePassword
-
setTrustStorePassword
-
getKeyManagerFactoryAlgorithm
-
setKeyManagerFactoryAlgorithm
-
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
Set Access-Control-Allow-Origin header value for http each response. Default isnull
If value isnull
then request ORIGIN header value used.- Parameters:
origin
- - origin
-
getOrigin
-
isUseLinuxNativeEpoll
public boolean isUseLinuxNativeEpoll() -
setUseLinuxNativeEpoll
public void setUseLinuxNativeEpoll(boolean useLinuxNativeEpoll) -
setSSLProtocol
Set the name of the requested SSL protocol- Parameters:
sslProtocol
- - name of protocol
-
getSSLProtocol
-
setAllowHeaders
Set the response Access-Control-Allow-Headers- Parameters:
allowHeaders
- - allow headers
-
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. Usesgzip
ordeflate
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. Usespermessage-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 isfalse
- Parameters:
needClientAuth
- -true
to use client authentication
-
isNeedClientAuth
public boolean isNeedClientAuth()
-