Interface Configurable
- All Known Subinterfaces:
JettyWebSocketServletFactory
,Session
- All Known Implementing Classes:
JettyWebSocketServerContainer
,ServerWebSocketContainer
,WebSocketClient
,WebSocketSession
Implementations allow to configure WebSocket parameters.
-
Method Summary
Modifier and TypeMethodDescriptionThe duration that a websocket may be idle before being closed by the implementationint
The input (read from network layer) buffer size.long
Get the maximum size of a binary message during parsing.long
The maximum payload size of any WebSocket Frame which can be received.int
Get the maximum number of data frames allowed to be waiting to be sent at any one time.long
Get the maximum size of a text message during parsing.int
The output (write to network layer) buffer size.boolean
If true, frames are automatically fragmented to respect the maximum frame size.void
setAutoFragment
(boolean autoFragment) If set to true, frames are automatically fragmented to respect the maximum frame size.void
setIdleTimeout
(Duration duration) The duration that a websocket may be idle before being closed by the implementationvoid
setInputBufferSize
(int size) The input (read from network layer) buffer size.void
setMaxBinaryMessageSize
(long size) The maximum size of a binary message during parsing/generating.void
setMaxFrameSize
(long maxFrameSize) The maximum payload size of any WebSocket Frame which can be received.void
setMaxOutgoingFrames
(int maxOutgoingFrames) Set the maximum number of data frames allowed to be waiting to be sent at any one time.void
setMaxTextMessageSize
(long size) The maximum size of a text message during parsing/generating.void
setOutputBufferSize
(int size) The output (write to network layer) buffer size.
-
Method Details
-
getIdleTimeout
Duration getIdleTimeout()The duration that a websocket may be idle before being closed by the implementation- Returns:
- the timeout duration
-
setIdleTimeout
The duration that a websocket may be idle before being closed by the implementation- Parameters:
duration
- the timeout duration (may not be null or negative)
-
getInputBufferSize
int getInputBufferSize()The input (read from network layer) buffer size.This is the raw read operation buffer size, before the parsing of the websocket frames.
- Returns:
- the raw network buffer input size.
-
setInputBufferSize
void setInputBufferSize(int size) The input (read from network layer) buffer size.- Parameters:
size
- the size in bytes
-
getOutputBufferSize
int getOutputBufferSize()The output (write to network layer) buffer size.This is the raw write operation buffer size and has no relationship to the websocket frame.
- Returns:
- the raw network buffer output size.
-
setOutputBufferSize
void setOutputBufferSize(int size) The output (write to network layer) buffer size.- Parameters:
size
- the size in bytes
-
getMaxBinaryMessageSize
long getMaxBinaryMessageSize()Get the maximum size of a binary message during parsing.This is a memory conservation option, memory over this limit will not be allocated by Jetty for handling binary messages. This applies to individual frames, whole message handling, and partial message handling.
Binary messages over this maximum will result in a close code 1009
StatusCode.MESSAGE_TOO_LARGE
- Returns:
- the maximum size of a binary message
-
setMaxBinaryMessageSize
void setMaxBinaryMessageSize(long size) The maximum size of a binary message during parsing/generating.Binary messages over this maximum will result in a close code 1009
StatusCode.MESSAGE_TOO_LARGE
- Parameters:
size
- the maximum allowed size of a binary message.
-
getMaxTextMessageSize
long getMaxTextMessageSize()Get the maximum size of a text message during parsing.This is a memory conservation option, memory over this limit will not be allocated by Jetty for handling text messages. This applies to individual frames, whole message handling, and partial message handling.
Text messages over this maximum will result in a close code 1009
StatusCode.MESSAGE_TOO_LARGE
- Returns:
- the maximum size of a text message.
-
setMaxTextMessageSize
void setMaxTextMessageSize(long size) The maximum size of a text message during parsing/generating.Text messages over this maximum will result in a close code 1009
StatusCode.MESSAGE_TOO_LARGE
- Parameters:
size
- the maximum allowed size of a text message.
-
getMaxFrameSize
long getMaxFrameSize()The maximum payload size of any WebSocket Frame which can be received.- Returns:
- the maximum size of a WebSocket Frame.
-
setMaxFrameSize
void setMaxFrameSize(long maxFrameSize) The maximum payload size of any WebSocket Frame which can be received.WebSocket Frames over this maximum will result in a close code 1009
StatusCode.MESSAGE_TOO_LARGE
- Parameters:
maxFrameSize
- the maximum allowed size of a WebSocket Frame.
-
isAutoFragment
boolean isAutoFragment()If true, frames are automatically fragmented to respect the maximum frame size.- Returns:
- whether to automatically fragment incoming WebSocket Frames.
-
setAutoFragment
void setAutoFragment(boolean autoFragment) If set to true, frames are automatically fragmented to respect the maximum frame size.- Parameters:
autoFragment
- whether to automatically fragment incoming WebSocket Frames.
-
getMaxOutgoingFrames
int getMaxOutgoingFrames()Get the maximum number of data frames allowed to be waiting to be sent at any one time. The default value is -1, this indicates there is no limit on how many frames can be queued to be sent by the implementation. If the limit is exceeded, subsequent frames sent are failed with aWritePendingException
but the connection is not failed and will remain open.- Returns:
- the max number of frames.
-
setMaxOutgoingFrames
void setMaxOutgoingFrames(int maxOutgoingFrames) Set the maximum number of data frames allowed to be waiting to be sent at any one time. The default value is -1, this indicates there is no limit on how many frames can be queued to be sent by the implementation. If the limit is exceeded, subsequent frames sent are failed with aWritePendingException
but the connection is not failed and will remain open.- Parameters:
maxOutgoingFrames
- the max number of frames.
-