public final class EngineIoServerOptions extends Object
EngineIoServer
Modifier and Type | Field and Description |
---|---|
static String[] |
ALLOWED_CORS_ORIGIN_ALL
Specify that all origins are to be allowed for CORS
|
static String[] |
ALLOWED_CORS_ORIGIN_NONE
Specify that no origins are allowed for CORS
|
static EngineIoServerOptions |
DEFAULT
The default options used by server.
|
Modifier and Type | Method and Description |
---|---|
String[] |
getAllowedCorsOrigins()
Gets the allowed CORS origins option.
|
EngineIoServer.HandshakeInterceptor |
getHandshakeInterceptor()
Gets the
EngineIoServer.HandshakeInterceptor for the server. |
Packet<?> |
getInitialPacket()
Gets the initial packet option.
|
int |
getMaxTimeoutThreadPoolSize()
Gets the max threadpool size for the ping timeout timers.
|
long |
getPingInterval()
Gets the ping interval option in milliseconds.
|
long |
getPingTimeout()
Gets the ping timeout option in milliseconds.
|
ScheduledExecutorService |
getScheduledExecutorService()
Gets the custom
ScheduledExecutorService for the server to use or null to let
the server create it's own executor. |
boolean |
isCorsHandlingDisabled()
Gets the value of 'isCorsHandlingDisabled' option.
|
boolean |
isSyncPollingAllowed()
Whether sync polling transport is allowed or not.
|
void |
lock()
Lock this options instance to prevent modifications.
|
static EngineIoServerOptions |
newFromDefault()
Create a new instance of
EngineIoServerOptions by copying
default options. |
EngineIoServerOptions |
setAllowedCorsOrigins(String[] allowedCorsOrigins)
Sets the allowed CORS origins option.
|
EngineIoServerOptions |
setAllowSyncPolling(boolean allowSyncPolling)
Sets whether sync polling transport is allowed or not.
|
EngineIoServerOptions |
setCorsHandlingDisabled(boolean corsHandlingDisabled)
Sets the 'isCorsHandlingDisabled' option.
|
void |
setHandshakeInterceptor(EngineIoServer.HandshakeInterceptor handshakeInterceptor)
Sets a
EngineIoServer.HandshakeInterceptor for the server. |
EngineIoServerOptions |
setInitialPacket(Packet<?> initialPacket)
Sets the initial packet.
|
EngineIoServerOptions |
setMaxTimeoutThreadPoolSize(int maxTimeoutThreadPoolSize)
Sets the max threadpool size for the ping timeout timers.
|
EngineIoServerOptions |
setPingInterval(long pingInterval)
Sets the ping interval option.
|
EngineIoServerOptions |
setPingTimeout(long pingTimeout)
Sets the ping timeout option.
|
void |
setScheduledExecutorService(ScheduledExecutorService scheduledExecutorService)
Sets a custom
ScheduledExecutorService for the server to use. |
public static final EngineIoServerOptions DEFAULT
public static final String[] ALLOWED_CORS_ORIGIN_ALL
public static final String[] ALLOWED_CORS_ORIGIN_NONE
public static EngineIoServerOptions newFromDefault()
EngineIoServerOptions
by copying
default options.EngineIoServerOptions
with default options.public boolean isCorsHandlingDisabled()
public EngineIoServerOptions setCorsHandlingDisabled(boolean corsHandlingDisabled) throws IllegalStateException
corsHandlingDisabled
- Boolean value for disabling CORS handling.IllegalStateException
- If instance is locked.public boolean isSyncPollingAllowed()
public EngineIoServerOptions setAllowSyncPolling(boolean allowSyncPolling)
public long getPingInterval()
public EngineIoServerOptions setPingInterval(long pingInterval) throws IllegalStateException
pingInterval
- Ping interval in milliseconds.IllegalStateException
- If instance is locked.public long getPingTimeout()
public EngineIoServerOptions setPingTimeout(long pingTimeout) throws IllegalStateException
pingTimeout
- Ping timeout in milliseconds.IllegalStateException
- If instance is locked.public String[] getAllowedCorsOrigins()
public EngineIoServerOptions setAllowedCorsOrigins(String[] allowedCorsOrigins) throws IllegalStateException
allowedCorsOrigins
- Array of strings containing allowed CORS origins.IllegalStateException
- If instance is locked.public Packet<?> getInitialPacket()
public EngineIoServerOptions setInitialPacket(Packet<?> initialPacket) throws IllegalStateException, IllegalArgumentException
initialPacket
- The initial packet to send on client connection.IllegalStateException
- If instance is locked.IllegalArgumentException
- If initialPacket.type is not message or data is null.public void lock()
public int getMaxTimeoutThreadPoolSize()
public EngineIoServerOptions setMaxTimeoutThreadPoolSize(int maxTimeoutThreadPoolSize) throws IllegalStateException
maxTimeoutThreadPoolSize
- Max threadpool size for handling ping timeouts.IllegalStateException
- If instance is locked.public ScheduledExecutorService getScheduledExecutorService()
ScheduledExecutorService
for the server to use or null to let
the server create it's own executor.public void setScheduledExecutorService(ScheduledExecutorService scheduledExecutorService)
ScheduledExecutorService
for the server to use.
This might be a good option if the application using this library already has
an executor service it manages and uses.
NOTE: Caller is responsible for shutting down this executor.scheduledExecutorService
- Custom ScheduledExecutorService
to use for timed tasks.public EngineIoServer.HandshakeInterceptor getHandshakeInterceptor()
EngineIoServer.HandshakeInterceptor
for the server.
EngineIoServer.HandshakeInterceptor
can be used to allow or block handshake.public void setHandshakeInterceptor(EngineIoServer.HandshakeInterceptor handshakeInterceptor)
EngineIoServer.HandshakeInterceptor
for the server.
EngineIoServer.HandshakeInterceptor
can be used to allow or block handshake.handshakeInterceptor
- Interceptor object to set for the server or null to remove it.Copyright © 2022. All rights reserved.