Class IntegrationWebSocketContainer
java.lang.Object
org.springframework.integration.websocket.IntegrationWebSocketContainer
- All Implemented Interfaces:
DisposableBean
- Direct Known Subclasses:
ClientWebSocketContainer
,ServerWebSocketContainer
public abstract class IntegrationWebSocketContainer extends Object implements DisposableBean
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
- See Also:
WebSocketInboundChannelAdapter
,WebSocketOutboundMessageHandler
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_SEND_BUFFER_SIZE
static int
DEFAULT_SEND_TIME_LIMIT
protected Log
logger
protected Map<String,WebSocketSession>
sessions
-
Constructor Summary
Constructors Constructor Description IntegrationWebSocketContainer()
-
Method Summary
Modifier and Type Method Description void
addSupportedProtocols(String... protocols)
void
closeSession(WebSocketSession session, CloseStatus closeStatus)
void
destroy()
WebSocketSession
getSession(String sessionId)
Map<String,WebSocketSession>
getSessions()
List<String>
getSubProtocols()
WebSocketHandler
getWebSocketHandler()
void
setMessageListener(WebSocketListener messageListener)
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:
- Constant Field Values
-
DEFAULT_SEND_BUFFER_SIZE
public static final int DEFAULT_SEND_BUFFER_SIZE- See Also:
- Constant Field Values
-
logger
-
sessions
-
-
Constructor Details
-
IntegrationWebSocketContainer
public IntegrationWebSocketContainer()
-
-
Method Details
-
setSendTimeLimit
public void setSendTimeLimit(int sendTimeLimit) -
setSendBufferSizeLimit
public void setSendBufferSizeLimit(int sendBufferSizeLimit) -
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
-