public class SockJSHandlerOptions extends Object
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_HEARTBEAT_INTERVAL
The default interval between heartbeat packets.
|
static boolean |
DEFAULT_INSERT_JSESSIONID
Whether a
JSESSIONID cookie should be inserted by default = true. |
static String |
DEFAULT_LIBRARY_URL
The default SockJS library URL to load in iframe when a transport does not support cross-domain communication natively.
|
static boolean |
DEFAULT_LOCAL_WRITE_HANDLER
Whether the
writeHandler should be registered as local by default = true. |
static int |
DEFAULT_MAX_BYTES_STREAMING
The default maximum number of bytes an HTTP streaming request can send.
|
static boolean |
DEFAULT_REGISTER_WRITE_HANDLER
Whether a
writeHandler should be registered by default = false. |
static long |
DEFAULT_SESSION_TIMEOUT
The default delay before sending a
close event to a silent client. |
Constructor and Description |
---|
SockJSHandlerOptions()
Default constructor.
|
SockJSHandlerOptions(JsonObject json)
Constructor to create options from JSON.
|
SockJSHandlerOptions(SockJSHandlerOptions other)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
SockJSHandlerOptions |
addDisabledTransport(String subProtocol)
Add a transport (by name) to the set of disabled transports.
|
Set<String> |
getDisabledTransports() |
long |
getHeartbeatInterval() |
String |
getLibraryURL() |
int |
getMaxBytesStreaming() |
long |
getSessionTimeout() |
boolean |
isInsertJSESSIONID() |
boolean |
isLocalWriteHandler() |
boolean |
isRegisterWriteHandler() |
SockJSHandlerOptions |
setHeartbeatInterval(long heartbeatInterval)
In order to keep proxies and load balancers from closing long running HTTP requests we need to pretend that the connection is active and send a heartbeat packet once in a while.
|
SockJSHandlerOptions |
setInsertJSESSIONID(boolean insertJSESSIONID)
Whether to insert a
JSESSIONID cookie so load-balancers ensure requests for a specific SockJS session are always routed to the correct server. |
SockJSHandlerOptions |
setLibraryURL(String libraryURL)
Transports which don't support cross-domain communication natively use an iframe trick.
|
SockJSHandlerOptions |
setLocalWriteHandler(boolean localWriteHandler)
Whether the
writeHandler should be local only or cluster-wide. |
SockJSHandlerOptions |
setMaxBytesStreaming(int maxBytesStreaming)
Most streaming transports save responses on the client side and don't free memory used by delivered messages.
|
SockJSHandlerOptions |
setRegisterWriteHandler(boolean registerWriteHandler)
Whether a
writeHandler should be registered on the EventBus . |
SockJSHandlerOptions |
setSessionTimeout(long sessionTimeout)
Set the delay before the server sends a
close event when a client receiving connection has not been seen for a while. |
public static final long DEFAULT_SESSION_TIMEOUT
close
event to a silent client.public static final boolean DEFAULT_INSERT_JSESSIONID
JSESSIONID
cookie should be inserted by default = true.public static final long DEFAULT_HEARTBEAT_INTERVAL
public static final int DEFAULT_MAX_BYTES_STREAMING
public static final String DEFAULT_LIBRARY_URL
public static final boolean DEFAULT_REGISTER_WRITE_HANDLER
writeHandler
should be registered by default = false.public static final boolean DEFAULT_LOCAL_WRITE_HANDLER
writeHandler
should be registered as local by default = true.public SockJSHandlerOptions(SockJSHandlerOptions other)
other
- the options to copypublic SockJSHandlerOptions()
public SockJSHandlerOptions(JsonObject json)
json
- the JSONpublic long getSessionTimeout()
public SockJSHandlerOptions setSessionTimeout(long sessionTimeout)
close
event when a client receiving connection has not been seen for a while.
Defaults to 5 seconds.
sessionTimeout
- timeout in millisecondspublic boolean isInsertJSESSIONID()
JSESSIONID
cookie should be inserted, false otherwisepublic SockJSHandlerOptions setInsertJSESSIONID(boolean insertJSESSIONID)
JSESSIONID
cookie so load-balancers ensure requests for a specific SockJS session are always routed to the correct server.
Defaults to true
.
insertJSESSIONID
- true if a JSESSIONID
cookie should be inserted, false otherwisepublic long getHeartbeatInterval()
public SockJSHandlerOptions setHeartbeatInterval(long heartbeatInterval)
Defaults to 25 seconds.
heartbeatInterval
- interval in millisecondspublic int getMaxBytesStreaming()
public SockJSHandlerOptions setMaxBytesStreaming(int maxBytesStreaming)
This setting controls the maximum number of bytes that can be sent over a single HTTP streaming request before it will be closed. After that the client needs to open new request. Setting this value to one effectively disables streaming and will make streaming transports to behave like polling transports.
Defaults to 128K.
maxBytesStreaming
- maximum number of bytes an HTTP streaming request can sendpublic String getLibraryURL()
public SockJSHandlerOptions setLibraryURL(String libraryURL)
Code run from this iframe doesn't need to worry about cross-domain issues, as it's being run from domain local to the SockJS server. This iframe also does need to load SockJS javascript client library, and this option lets you specify its URL.
libraryURL
- the SockJS library URLpublic SockJSHandlerOptions addDisabledTransport(String subProtocol)
subProtocol
- the transport to disableTransport
public Set<String> getDisabledTransports()
public boolean isRegisterWriteHandler()
writeHandler
should be registered on the EventBus
, false otherwiseSockJSSocket.writeHandlerID()
public SockJSHandlerOptions setRegisterWriteHandler(boolean registerWriteHandler)
registerWriteHandler
- true to register a writeHandler
SockJSSocket.writeHandlerID()
public boolean isLocalWriteHandler()
writeHandler
is local only, false otherwiseSockJSSocket.writeHandlerID()
public SockJSHandlerOptions setLocalWriteHandler(boolean localWriteHandler)
writeHandler
should be local only or cluster-wide.
Defaults to true
.
localWriteHandler
- true to register locally, false otherwiseSockJSSocket.writeHandlerID()
Copyright © 2021 Eclipse. All rights reserved.