Class WebSocketServerConfig

java.lang.Object
io.vertx.core.http.WebSocketServerConfig

@Unstable public class WebSocketServerConfig extends Object
WebSocket server configuration.
Author:
Julien Viet
  • Constructor Details

    • WebSocketServerConfig

      public WebSocketServerConfig()
    • WebSocketServerConfig

      public WebSocketServerConfig(WebSocketServerConfig other)
  • Method Details

    • addWebSocketSubProtocol

      public WebSocketServerConfig addWebSocketSubProtocol(String subProtocol)
      Add a WebSocket sub-protocol to the list supported by the server.
      Parameters:
      subProtocol - the sub-protocol to add
      Returns:
      a reference to this, so the API can be used fluently
    • setSubProtocols

      public WebSocketServerConfig setSubProtocols(List<String> subProtocols)
      Set the WebSocket list of sub-protocol supported by the server.
      Parameters:
      subProtocols - comma separated list of sub-protocols
      Returns:
      a reference to this, so the API can be used fluently
    • getSubProtocols

      public List<String> getSubProtocols()
      Returns:
      Get the WebSocket list of sub-protocol
    • getClosingTimeout

      public Duration getClosingTimeout()
      Returns:
      the amount of time (in seconds) a client WebSocket will wait until it closes TCP connection after receiving a close frame
    • setClosingTimeout

      public WebSocketServerConfig setClosingTimeout(Duration closingTimeout)
      Set the amount of time a server WebSocket will wait until it closes the TCP connection after sending a close frame.

      When a server closes a WebSocket, it should wait the client close frame to close the TCP connection. This timeout will close the TCP connection on the server when it expires. When the TCP connection is closed receiving the close frame, the WebSocket.exceptionHandler(Handler) instead of the WebSocket.endHandler(Handler) will be called.

      Set to 0L closes the TCP connection immediately after sending the close frame.

      Set to a negative value to disable it.

      Parameters:
      closingTimeout - the duration of the timeout
      Returns:
      a reference to this, so the API can be used fluently
    • getMaxFrameSize

      public int getMaxFrameSize()
      Returns:
      the maximum WebSocket frame size
    • setMaxFrameSize

      public WebSocketServerConfig setMaxFrameSize(int maxFrameSize)
      Set the maximum WebSocket frames size
      Parameters:
      maxFrameSize - the maximum frame size in bytes.
      Returns:
      a reference to this, so the API can be used fluently
    • getMaxMessageSize

      public int getMaxMessageSize()
      Returns:
      the maximum WebSocket message size
    • setMaxMessageSize

      public WebSocketServerConfig setMaxMessageSize(int maxMessageSize)
      Set the maximum WebSocket message size
      Parameters:
      maxMessageSize - the maximum message size in bytes.
      Returns:
      a reference to this, so the API can be used fluently
    • getUsePerFrameCompression

      public boolean getUsePerFrameCompression()
      Returns:
      whether the endpoint will send or accept the per-frame deflate compression extension
    • setUsePerFrameCompression

      public WebSocketServerConfig setUsePerFrameCompression(boolean use)
      Set whether the WebSocket per-frame deflate compression extension is used or supported.
      Parameters:
      use - whether the per-frame deflate compression extension will be sent or accepted
      Returns:
      a reference to this, so the API can be used fluently
    • getUsePerMessageCompression

      public boolean getUsePerMessageCompression()
      Returns:
      whether the endpoint will send or accept the per-frame deflate compression extension
    • setUsePerMessageCompression

      public WebSocketServerConfig setUsePerMessageCompression(boolean use)
      Set whether the WebSocket per-message deflate compression extension is used or supported.
      Parameters:
      use - whether the per-frame deflate compression extension will be sent or accepted
      Returns:
      a reference to this, so the API can be used fluently
    • getCompressionLevel

      public int getCompressionLevel()
      Returns:
      the current WebSocket deflate compression level
    • setCompressionLevel

      public WebSocketServerConfig setCompressionLevel(int compressionLevel)
      Set the WebSocket compression level.
      Parameters:
      compressionLevel - the compression level
      Returns:
      a reference to this, so the API can be used fluently
    • isUseUnmaskedFrames

      public boolean isUseUnmaskedFrames()
      Returns:
      whether WebSocket unmasked frames are used or supported
    • setUseUnmaskedFrames

      public WebSocketServerConfig setUseUnmaskedFrames(boolean use)
      Set whether WebSocket unmasked frames are used or supported
      Parameters:
      use - whether the masked frames are used or supported
      Returns:
      a reference to this, so the API can be used fluently
    • getUseServerNoContext

      public boolean getUseServerNoContext()
      Returns:
      whether the WebSocket server_no_context_takeover parameter of the per-message deflate compression is used or supported.
    • setUseServerNoContext

      public WebSocketServerConfig setUseServerNoContext(boolean use)
      Set whether the WebSocket server_no_context_takeover parameter of the per-message deflate compression is used or supported.
      Parameters:
      use - whether the WebSocket server_no_context_takeover parameter of the per-message deflate compression is used or supported.
      Returns:
      a reference to this, so the API can be used fluently
    • getUseClientNoContext

      public boolean getUseClientNoContext()
      Returns:
      use whether the WebSocket client_no_context_takeover parameter of the per-message deflate compression is used or supported.
    • setUseClientNoContext

      public WebSocketServerConfig setUseClientNoContext(boolean use)
      Set whether the WebSocket client_no_context_takeover parameter of the per-message deflate compression is used or supported.
      Parameters:
      use - whether the WebSocket client_no_context_takeover parameter of the per-message deflate compression is used or supported.
      Returns:
      a reference to this, so the API can be used fluently