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 classes/interfaces inherited from interface org.glassfish.tyrus.spi.WebSocketEngine
WebSocketEngine.UpgradeInfo, WebSocketEngine.UpgradeStatus
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Maximum size of incoming buffer in bytes.static final String
Maximum number of open sessions per server application.static final String
Maximum number of open sessions per unique remote address.static final String
Parallel broadcast support.static final String
Property used for configuring tracing threshold.static final String
Property used for configuring the type of tracing supported by the server.static final String
Wsadl support. -
Method Summary
Modifier and TypeMethodDescriptionbuilder
(WebSocketContainer webSocketContainer) CreateTyrusWebSocketEngine.TyrusWebSocketEngineBuilder
instance based on passedWebSocketContainer
.GetApplicationEventListener
related to currentTyrusWebSocketEngine
instance.GetApplication
representing current set of deployed endpoints.void
register
(ServerEndpointConfig serverConfig, String contextPath) RegisterServerEndpointConfig
.void
Register endpoint class.void
setIncomingBufferSize
(int incomingBufferSize) Deprecated.void
unregister
(TyrusEndpointWrapper endpointWrapper) Un-registers the specifiedTyrusEndpointWrapper
with 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
Integer
or 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
Integer
or 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
Integer
or 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
true
orfalse
and the default value isfalse
.- See Also:
-
-
Method Details
-
builder
public static TyrusWebSocketEngine.TyrusWebSocketEngineBuilder builder(WebSocketContainer webSocketContainer) CreateTyrusWebSocketEngine.TyrusWebSocketEngineBuilder
instance based on passedWebSocketContainer
.- Parameters:
webSocketContainer
-WebSocketContainer
instance. Cannot benull
.- Returns:
- new builder.
-
upgrade
Description copied from interface:WebSocketEngine
A transport calls this method to upgrade a HTTP request.- Specified by:
upgrade
in 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:WebSocketEngine
Register endpoint class.- Specified by:
register
in 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:WebSocketEngine
RegisterServerEndpointConfig
.- Specified by:
register
in 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 specifiedTyrusEndpointWrapper
with theWebSocketEngine
.- Parameters:
endpointWrapper
- theTyrusEndpointWrapper
to un-register.
-
getApplicationEventListener
GetApplicationEventListener
related to currentTyrusWebSocketEngine
instance.- Returns:
- listener instance.
-
getWsadlApplication
GetApplication
representing current set of deployed endpoints.- Returns:
- application representing current set of deployed endpoints.
-
.TyrusWebSocketEngineBuilder#incomingBufferSize(Integer)
instead.