Class IntegrationWebSocketContainer
java.lang.Object
org.springframework.integration.websocket.IntegrationWebSocketContainer
- All Implemented Interfaces:
DisposableBean
- Direct Known Subclasses:
ClientWebSocketContainer
,ServerWebSocketContainer
The high-level 'connection factory pattern' contract over low-level Web-Socket
configuration.
Provides the composition for the internal WebSocketHandler
implementation, which is used with native Web-Socket containers.
Collects established WebSocketSession
s, which can be accessed using
getSession(String)
.
Can accept the WebSocketListener
to delegate WebSocketSession
events
from the internal IntegrationWebSocketContainer.IntegrationWebSocketHandler
.
Supported sub-protocols can be configured, but SubProtocolCapable.getSubProtocols()
have a precedent.
- Since:
- 4.1
- Author:
- Artem Bilan, Gary Russell, Julian Koch
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
protected final Lock
protected final Log
protected final Map<String,
WebSocketSession> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addSupportedProtocols
(String... protocols) void
closeSession
(WebSocketSession session, CloseStatus closeStatus) void
destroy()
getSession
(String sessionId) void
setMessageListener
(WebSocketListener messageListener) void
setSendBufferOverflowStrategy
(ConcurrentWebSocketSessionDecorator.OverflowStrategy overflowStrategy) Set the send buffer overflow strategy.void
setSendBufferSizeLimit
(int sendBufferSizeLimit) void
setSendTimeLimit
(int sendTimeLimit) void
setSupportedProtocols
(String... protocols) protected void
setWebSocketHandler
(WebSocketHandler handler) Replace the defaultWebSocketHandler
with the one provided here, e.g.
-
Field Details
-
DEFAULT_SEND_TIME_LIMIT
public static final int DEFAULT_SEND_TIME_LIMIT- See Also:
-
DEFAULT_SEND_BUFFER_SIZE
public static final int DEFAULT_SEND_BUFFER_SIZE- See Also:
-
logger
-
lock
-
sessions
-
-
Constructor Details
-
IntegrationWebSocketContainer
public IntegrationWebSocketContainer()
-
-
Method Details
-
setSendTimeLimit
public void setSendTimeLimit(int sendTimeLimit) -
setSendBufferSizeLimit
public void setSendBufferSizeLimit(int sendBufferSizeLimit) -
setSendBufferOverflowStrategy
public void setSendBufferOverflowStrategy(@Nullable ConcurrentWebSocketSessionDecorator.OverflowStrategy overflowStrategy) Set the send buffer overflow strategy.Concurrently generated outbound messages are buffered if sending is slow. This strategy determines the behavior when the buffer has reached the limit configured with
setSendBufferSizeLimit(int)
.- Parameters:
overflowStrategy
- TheConcurrentWebSocketSessionDecorator.OverflowStrategy
to use.- Since:
- 5.5.19
- See Also:
-
setMessageListener
-
setSupportedProtocols
-
addSupportedProtocols
-
setWebSocketHandler
Replace the defaultWebSocketHandler
with the one provided here, e.g. via decoration factories.- Parameters:
handler
- the actualWebSocketHandler
to replace.- Since:
- 5.5.18
-
getWebSocketHandler
-
getSubProtocols
-
getSessions
-
getSession
-
closeSession
- Throws:
Exception
-
destroy
public void destroy()- Specified by:
destroy
in interfaceDisposableBean
-