Class TyrusWebSocketEngine
- All Implemented Interfaces:
WebSocketEngine
WebSocketEngine implementation, which handles server-side handshake, validation and data processing.- Author:
- Alexey Stashok, Pavel Bucek
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.glassfish.tyrus.spi.WebSocketEngine
WebSocketEngine.UpgradeInfo, WebSocketEngine.UpgradeStatus -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringMaximum size of incoming buffer in bytes.static final StringMaximum number of open sessions per server application.static final StringMaximum number of open sessions per unique remote address.static final StringParallel broadcast support.static StringDefines theThreadFactoryto be used by internal default Executor Services.static final StringProperty used for configuring tracing threshold.static final StringProperty used for configuring the type of tracing supported by the server.static final StringDefines whether the virtual threads should be used by internal Executor Services in Tyrus on JDK 21+ when not using an exact number of threads byFixedThreadPool.static final StringWsadl support. -
Method Summary
Modifier and TypeMethodDescriptionbuilder(WebSocketContainer webSocketContainer) CreateTyrusWebSocketEngine.TyrusWebSocketEngineBuilderinstance based on passedWebSocketContainer.GetApplicationEventListenerrelated to currentTyrusWebSocketEngineinstance.GetApplicationrepresenting current set of deployed endpoints.voidregister(ServerEndpointConfig serverConfig, String contextPath) RegisterServerEndpointConfig.voidRegister endpoint class.voidsetIncomingBufferSize(int incomingBufferSize) Deprecated.voidunregister(TyrusEndpointWrapper endpointWrapper) Un-registers the specifiedTyrusEndpointWrapperwith theWebSocketEngine.upgrade(UpgradeRequest request, UpgradeResponse response) A transport calls this method to upgrade a HTTP request.
-
Field Details
-
INCOMING_BUFFER_SIZE
Maximum size of incoming buffer in bytes.The value must be
Integeror its primitive alternative.Default value is 4194315, which means that TyrusWebSocketEngine is by default capable of processing messages up to 4 MB.
- See Also:
-
MAX_SESSIONS_PER_APP
Maximum number of open sessions per server application.The value must be positive
Integeror its primitive alternative. Negative values and zero are ignored.The number of open sessions per application is not limited by default.
- See Also:
-
MAX_SESSIONS_PER_REMOTE_ADDR
Maximum number of open sessions per unique remote address.The value must be positive
Integeror its primitive alternative. Negative values and zero are ignored.The number of open sessions per remote address is not limited by default.
- See Also:
-
TRACING_TYPE
Property used for configuring the type of tracing supported by the server.The value is expected to be string value of
DebugContext.TracingType.The default value is
DebugContext.TracingType.OFF.- See Also:
-
TRACING_THRESHOLD
Property used for configuring tracing threshold.The value is expected to be string value of
DebugContext.TracingThreshold.The default value is
DebugContext.TracingThreshold.SUMMARY.- See Also:
-
WSADL_SUPPORT
Wsadl support.Wsadl is experimental feature which exposes endpoint configuration in form of XML file, similarly as Wadl for REST services. Currently generated Wsadl contains only set of endpoints and their endpoint paths. Wsadl is exposed on URI ending by "application.wsadl".
The value must be string,
"true"means that the feature is enable,"false"that the feature is disabled.Default value is "false";
- See Also:
-
PARALLEL_BROADCAST_ENABLED
Parallel broadcast support.TyrusSession.broadcast(String)and.TyrusSession#broadcast(java.nio.ByteBuffer)operations are by default executed in parallel. The parallel execution of broadcast can be disabled by setting this server property tofalse.Expected value is
trueorfalseand the default value isfalse.- See Also:
-
THREAD_FACTORY
Defines the
ThreadFactoryto be used by internal default Executor Services.- Since:
- 2.0.8
-
USE_VIRTUAL_THREADS
Defines whether the virtual threads should be used by internal Executor Services in Tyrus on JDK 21+ when not using an exact number of threads by
FixedThreadPool.The default is
falsefor this version of Tyrus.- Since:
- 2.0.8
- See Also:
-
-
Method Details
-
builder
public static TyrusWebSocketEngine.TyrusWebSocketEngineBuilder builder(WebSocketContainer webSocketContainer) CreateTyrusWebSocketEngine.TyrusWebSocketEngineBuilderinstance based on passedWebSocketContainer.- Parameters:
webSocketContainer-WebSocketContainerinstance. Cannot benull.- Returns:
- new builder.
-
upgrade
Description copied from interface:WebSocketEngineA transport calls this method to upgrade a HTTP request.- Specified by:
upgradein interfaceWebSocketEngine- Parameters:
request- request to be upgraded.response- response to the upgrade request.- Returns:
- info about upgrade status and connection details.
-
setIncomingBufferSize
public void setIncomingBufferSize(int incomingBufferSize) Deprecated.Please use.TyrusWebSocketEngineBuilder#incomingBufferSize(Integer)instead.Set incoming buffer size.- Parameters:
incomingBufferSize- buffer size in bytes.
-
register
Description copied from interface:WebSocketEngineRegister endpoint class.- Specified by:
registerin interfaceWebSocketEngine- Parameters:
endpointClass- endpoint class to be registered.contextPath- context path of the registered endpoint.- Throws:
DeploymentException- when the endpoint is invalid.
-
register
public void register(ServerEndpointConfig serverConfig, String contextPath) throws DeploymentException Description copied from interface:WebSocketEngineRegisterServerEndpointConfig.- Specified by:
registerin interfaceWebSocketEngine- Parameters:
serverConfig- server endpoint to be registered.contextPath- context path of the registered endpoint.- Throws:
DeploymentException- when the endpoint is invalid.
-
unregister
Un-registers the specifiedTyrusEndpointWrapperwith theWebSocketEngine.- Parameters:
endpointWrapper- theTyrusEndpointWrapperto un-register.
-
getApplicationEventListener
GetApplicationEventListenerrelated to currentTyrusWebSocketEngineinstance.- Returns:
- listener instance.
-
getWsadlApplication
GetApplicationrepresenting current set of deployed endpoints.- Returns:
- application representing current set of deployed endpoints.
-
.TyrusWebSocketEngineBuilder#incomingBufferSize(Integer)instead.