Package com.corundumstudio.socketio
Class Configuration
java.lang.Object
com.corundumstudio.socketio.Configuration
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintintintintintintintgetPort()intintbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanvoidsetAckMode(AckMode ackMode) Auto ack-response mode Default isAckMode.AUTO_SUCCESS_ONLYvoidsetAddVersionHeader(boolean addVersionHeader) Adds Server header with lib version to http response.voidsetAllowCustomRequests(boolean allowCustomRequests) Allow to service custom requests differs from socket.io protocol.voidsetAllowHeaders(String allowHeaders) Set the response Access-Control-Allow-HeadersvoidsetAuthorizationListener(AuthorizationListener authorizationListener) Authorization listener invoked on every handshake.voidsetBossThreads(int bossThreads) voidsetContext(String context) voidsetExceptionListener(ExceptionListener exceptionListener) Exception listener invoked on any exception in SocketIO listenervoidsetFirstDataTimeout(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 casevoidsetHostname(String hostname) Optional parameter.voidsetHttpCompression(boolean httpCompression) Activate http protocol compression.voidsetJsonSupport(JsonSupport jsonSupport) Allows to setup custom implementation of JSON serialization/deserializationvoidsetKeyManagerFactoryAlgorithm(String keyManagerFactoryAlgorithm) voidsetKeyStore(InputStream keyStore) SSL key store stream, maybe appointed to any sourcevoidsetKeyStoreFormat(String keyStoreFormat) Key store formatvoidsetKeyStorePassword(String keyStorePassword) SSL key store passwordvoidsetMaxFramePayloadLength(int maxFramePayloadLength) Set maximum websocket frame content length limitvoidsetMaxHttpContentLength(int value) Set maximum http content length limitvoidsetNeedClientAuth(boolean needClientAuth) Enable/disable client authentication.voidSet Access-Control-Allow-Origin header value for http each response.voidsetPackagePrefix(String packagePrefix) Package prefix for sending json-object from client without full class name.voidsetPingInterval(int heartbeatIntervalSecs) Ping intervalvoidsetPingTimeout(int heartbeatTimeoutSecs) Ping timeout Use0to disable itvoidsetPort(int port) voidsetPreferDirectBuffer(boolean preferDirectBuffer) Buffer allocation method used during packet encoding.voidsetRandomSession(boolean randomSession) voidsetSocketConfig(SocketConfig socketConfig) TCP socket configurationvoidsetSSLProtocol(String sslProtocol) Set the name of the requested SSL protocolvoidsetStoreFactory(StoreFactory clientStoreFactory) Data store - used to store session data and implements distributed pubsub.voidsetTransports(Transport... transports) Transports supported by servervoidsetTrustStore(InputStream trustStore) voidsetTrustStoreFormat(String trustStoreFormat) voidsetTrustStorePassword(String trustStorePassword) voidsetUpgradeTimeout(int upgradeTimeout) Transport upgrade timeout in millisecondsvoidsetUseLinuxNativeEpoll(boolean useLinuxNativeEpoll) voidsetWebsocketCompression(boolean websocketCompression) Activate websocket protocol compression.voidsetWorkerThreads(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 Use0to 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- -trueto 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-trueif a direct buffer should be tried to be used as target for the encoded messages. Iffalseis 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.getAuthorizationResultmethod. 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- -trueto add header
-
isAddVersionHeader
public boolean isAddVersionHeader() -
setOrigin
Set Access-Control-Allow-Origin header value for http each response. Default isnullIf value isnullthen 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. Usesgzipordeflateencoding choice depends on the"Accept-Encoding"header value.Default is
true- Parameters:
httpCompression- -trueto use http compression
-
isHttpCompression
public boolean isHttpCompression() -
setWebsocketCompression
public void setWebsocketCompression(boolean websocketCompression) Activate websocket protocol compression. Usespermessage-deflateencoding only.Default is
true- Parameters:
websocketCompression- -trueto 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- -trueto use client authentication
-
isNeedClientAuth
public boolean isNeedClientAuth()
-