Interface WebSocketPolicy
- All Known Subinterfaces:
JettyWebSocketServletFactory,Session
- All Known Implementing Classes:
JettyWebSocketServerContainer,WebSocketClient,WebSocketSession
-
Method Summary
Modifier and TypeMethodDescriptionThe duration that a websocket may be idle before being closed by the implementationintThe input (read from network layer) buffer size.longGet the maximum size of a binary message during parsing.longThe maximum payload size of any WebSocket Frame which can be received.longGet the maximum size of a text message during parsing.intThe output (write to network layer) buffer size.booleanIf true, frames are automatically fragmented to respect the maximum frame size.voidsetAutoFragment(boolean autoFragment) If set to true, frames are automatically fragmented to respect the maximum frame size.voidsetIdleTimeout(Duration duration) The duration that a websocket may be idle before being closed by the implementationvoidsetInputBufferSize(int size) The input (read from network layer) buffer size.voidsetMaxBinaryMessageSize(long size) The maximum size of a binary message during parsing/generating.voidsetMaxFrameSize(long maxFrameSize) The maximum payload size of any WebSocket Frame which can be received.voidsetMaxTextMessageSize(long size) The maximum size of a text message during parsing/generating.voidsetOutputBufferSize(int size) The output (write to network layer) buffer size.
-
Method Details
-
getBehavior
WebSocketBehavior getBehavior() -
getIdleTimeout
Duration getIdleTimeout()The duration that a websocket may be idle before being closed by the implementation- Returns:
- the timeout duration
-
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.
-
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.
-
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
-
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.
-
getMaxFrameSize
long getMaxFrameSize()The maximum payload size of any WebSocket Frame which can be received.- Returns:
- the maximum 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.
-
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)
-
setInputBufferSize
void setInputBufferSize(int size) The input (read from network layer) buffer size.- Parameters:
size- the size in bytes
-
setOutputBufferSize
void setOutputBufferSize(int size) The output (write to network layer) buffer size.- Parameters:
size- the size in bytes
-
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.
-
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.
-
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.
-
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.
-