Class IntegrationWebSocketContainer
java.lang.Object
org.springframework.integration.websocket.IntegrationWebSocketContainer
- All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean
- Direct Known Subclasses:
ClientWebSocketContainer,ServerWebSocketContainer
public abstract class IntegrationWebSocketContainer
extends java.lang.Object
implements org.springframework.beans.factory.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 WebSocketSessions, 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
- See Also:
WebSocketInboundChannelAdapter,WebSocketOutboundMessageHandler
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_SEND_BUFFER_SIZEstatic intDEFAULT_SEND_TIME_LIMITprotected org.apache.commons.logging.Logloggerprotected java.util.Map<java.lang.String,org.springframework.web.socket.WebSocketSession>sessionsprotected org.springframework.web.socket.WebSocketHandlerwebSocketHandler -
Constructor Summary
Constructors Constructor Description IntegrationWebSocketContainer() -
Method Summary
Modifier and Type Method Description voidaddSupportedProtocols(java.lang.String... protocols)voidcloseSession(org.springframework.web.socket.WebSocketSession session, org.springframework.web.socket.CloseStatus closeStatus)voiddestroy()org.springframework.web.socket.WebSocketSessiongetSession(java.lang.String sessionId)java.util.Map<java.lang.String,org.springframework.web.socket.WebSocketSession>getSessions()java.util.List<java.lang.String>getSubProtocols()voidsetMessageListener(WebSocketListener messageListener)voidsetSendBufferSizeLimit(int sendBufferSizeLimit)voidsetSendTimeLimit(int sendTimeLimit)voidsetSupportedProtocols(java.lang.String... protocols)
-
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
protected final org.apache.commons.logging.Log logger -
webSocketHandler
protected final org.springframework.web.socket.WebSocketHandler webSocketHandler -
sessions
protected final java.util.Map<java.lang.String,org.springframework.web.socket.WebSocketSession> sessions
-
-
Constructor Details
-
IntegrationWebSocketContainer
public IntegrationWebSocketContainer()
-
-
Method Details
-
setSendTimeLimit
public void setSendTimeLimit(int sendTimeLimit) -
setSendBufferSizeLimit
public void setSendBufferSizeLimit(int sendBufferSizeLimit) -
setMessageListener
-
setSupportedProtocols
public void setSupportedProtocols(java.lang.String... protocols) -
addSupportedProtocols
public void addSupportedProtocols(java.lang.String... protocols) -
getSubProtocols
public java.util.List<java.lang.String> getSubProtocols() -
getSessions
public java.util.Map<java.lang.String,org.springframework.web.socket.WebSocketSession> getSessions() -
getSession
public org.springframework.web.socket.WebSocketSession getSession(java.lang.String sessionId) -
closeSession
public void closeSession(org.springframework.web.socket.WebSocketSession session, org.springframework.web.socket.CloseStatus closeStatus) throws java.lang.Exception- Throws:
java.lang.Exception
-
destroy
public void destroy()- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean
-