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 int DEFAULT_SEND_BUFFER_SIZE  
    static int DEFAULT_SEND_TIME_LIMIT  
    protected org.apache.commons.logging.Log logger  
    protected java.util.Map<java.lang.String,​org.springframework.web.socket.WebSocketSession> sessions  
    protected org.springframework.web.socket.WebSocketHandler webSocketHandler  
  • Constructor Summary

    Constructors 
    Constructor Description
    IntegrationWebSocketContainer()  
  • Method Summary

    Modifier and Type Method Description
    void addSupportedProtocols​(java.lang.String... protocols)  
    void closeSession​(org.springframework.web.socket.WebSocketSession session, org.springframework.web.socket.CloseStatus closeStatus)  
    void destroy()  
    org.springframework.web.socket.WebSocketSession getSession​(java.lang.String sessionId)  
    java.util.Map<java.lang.String,​org.springframework.web.socket.WebSocketSession> getSessions()  
    java.util.List<java.lang.String> getSubProtocols()  
    void setMessageListener​(WebSocketListener messageListener)  
    void setSendBufferSizeLimit​(int sendBufferSizeLimit)  
    void setSendTimeLimit​(int sendTimeLimit)  
    void setSupportedProtocols​(java.lang.String... protocols)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • setSendTimeLimit

      public void setSendTimeLimit​(int sendTimeLimit)
    • setSendBufferSizeLimit

      public void setSendBufferSizeLimit​(int sendBufferSizeLimit)
    • setMessageListener

      public void setMessageListener​(WebSocketListener messageListener)
    • 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:
      destroy in interface org.springframework.beans.factory.DisposableBean