Package io.vertx.mqtt

Class MqttServerOptions


  • public class MqttServerOptions
    extends NetServerOptions
    Represents options used by the MQTT server
    • Field Detail

      • DEFAULT_MAX_MESSAGE_SIZE

        public static final int DEFAULT_MAX_MESSAGE_SIZE
        See Also:
        Constant Field Values
      • DEFAULT_AUTO_CLIENT_ID

        public static final boolean DEFAULT_AUTO_CLIENT_ID
        See Also:
        Constant Field Values
      • DEFAULT_MAX_CLIENT_ID_LENGTH

        public static final int DEFAULT_MAX_CLIENT_ID_LENGTH
        See Also:
        Constant Field Values
      • DEFAULT_TIMEOUT_ON_CONNECT

        public static final int DEFAULT_TIMEOUT_ON_CONNECT
        See Also:
        Constant Field Values
      • DEFAULT_USE_WEB_SOCKET

        public static final boolean DEFAULT_USE_WEB_SOCKET
        See Also:
        Constant Field Values
      • DEFAULT_WEB_SOCKET_MAX_FRAME_SIZE

        public static final int DEFAULT_WEB_SOCKET_MAX_FRAME_SIZE
        See Also:
        Constant Field Values
      • DEFAULT_PER_FRAME_WEBSOCKET_COMPRESSION_SUPPORTED

        public static final boolean DEFAULT_PER_FRAME_WEBSOCKET_COMPRESSION_SUPPORTED
        See Also:
        Constant Field Values
      • DEFAULT_PER_MESSAGE_WEBSOCKET_COMPRESSION_SUPPORTED

        public static final boolean DEFAULT_PER_MESSAGE_WEBSOCKET_COMPRESSION_SUPPORTED
        See Also:
        Constant Field Values
      • DEFAULT_WEBSOCKET_COMPRESSION_LEVEL

        public static final int DEFAULT_WEBSOCKET_COMPRESSION_LEVEL
        See Also:
        Constant Field Values
      • DEFAULT_WEBSOCKET_ALLOW_SERVER_NO_CONTEXT

        public static final boolean DEFAULT_WEBSOCKET_ALLOW_SERVER_NO_CONTEXT
        See Also:
        Constant Field Values
      • DEFAULT_WEBSOCKET_PREFERRED_CLIENT_NO_CONTEXT

        public static final boolean DEFAULT_WEBSOCKET_PREFERRED_CLIENT_NO_CONTEXT
        See Also:
        Constant Field Values
    • Constructor Detail

      • MqttServerOptions

        public MqttServerOptions()
        Default constructor
      • MqttServerOptions

        public MqttServerOptions​(JsonObject json)
        Create an options from JSON
        Parameters:
        json - the JSON
      • MqttServerOptions

        public MqttServerOptions​(MqttServerOptions other)
        Copy constructor
        Parameters:
        other - the options to copy
    • Method Detail

      • setMaxMessageSize

        public MqttServerOptions setMaxMessageSize​(int maxMessageSize)
        Set max MQTT message size
        Parameters:
        maxMessageSize - max MQTT message size (variable header + payload)
        Returns:
        MQTT server options instance
      • getMaxMessageSize

        public int getMaxMessageSize()
        Returns:
        max MQTT message size (variable header + payload)
      • setAutoClientId

        public MqttServerOptions setAutoClientId​(boolean isAutoClientId)
        Set if clientid should be auto-generated when it's "zero-bytes"
        Parameters:
        isAutoClientId -
        Returns:
        MQTT server options instance
      • isAutoClientId

        public boolean isAutoClientId()
        Returns:
        if clientid should be auto-generated when it's "zero-bytes" (default is true)
      • getMaxClientIdLength

        public int getMaxClientIdLength()
        Returns:
        the max client id length
      • setMaxClientIdLength

        public MqttServerOptions setMaxClientIdLength​(int maxClientIdLength)
        Set the max client id length.
        Parameters:
        maxClientIdLength - the new value
        Returns:
        MQTT server options instance
      • setTimeoutOnConnect

        public MqttServerOptions setTimeoutOnConnect​(int timeoutOnConnect)
        Set the timeout on CONNECT packet
        Parameters:
        timeoutOnConnect - timeout on CONNECT before closing connection
        Returns:
        MQTT server options instance
      • timeoutOnConnect

        public int timeoutOnConnect()
        Returns:
        timeout on CONNECT before closing connection
      • setUseWebSocket

        public MqttServerOptions setUseWebSocket​(boolean useWebSocket)
        enable mqtt over websocket
        Parameters:
        useWebSocket - use mqtt over websocket
        Returns:
        MQTT server options instance
      • isUseWebSocket

        public boolean isUseWebSocket()
        Returns:
        use mqtt over websocket
      • getWebSocketMaxFrameSize

        public int getWebSocketMaxFrameSize()
        Returns:
        the WebSocket max frame size
      • setWebSocketMaxFrameSize

        public void setWebSocketMaxFrameSize​(int webSocketMaxFrameSize)
        Set the WebSocket max frame size.

        This should be used when WebSocket transport is used and maxMessageSize is larger than the WebSocket frame size

        Parameters:
        webSocketMaxFrameSize - the new frame size
      • isPerFrameWebSocketCompressionSupported

        public boolean isPerFrameWebSocketCompressionSupported()
        Get whether WebSocket the per-frame deflate compression extension is supported.
        Returns:
        true if the http server will accept the per-frame deflate compression extension
      • setPerFrameWebSocketCompressionSupported

        public MqttServerOptions setPerFrameWebSocketCompressionSupported​(boolean supported)
        Enable or disable support for the WebSocket per-frame deflate compression extension.
        Parameters:
        supported - true when the per-frame deflate compression extension is supported
        Returns:
        a reference to this, so the API can be used fluently
      • isPerMessageWebSocketCompressionSupported

        public boolean isPerMessageWebSocketCompressionSupported()
        Get whether WebSocket the per-frame deflate compression extension is supported.
        Returns:
        true if the http server will accept the per-frame deflate compression extension
      • setPerMessageWebSocketCompressionSupported

        public MqttServerOptions setPerMessageWebSocketCompressionSupported​(boolean supported)
        Enable or disable support for WebSocket per-message deflate compression extension.
        Parameters:
        supported - true when the per-message WebSocket compression extension is supported
        Returns:
        a reference to this, so the API can be used fluently
      • getWebSocketCompressionLevel

        public int getWebSocketCompressionLevel()
        Returns:
        the current WebSocket deflate compression level
      • setWebSocketCompressionLevel

        public MqttServerOptions setWebSocketCompressionLevel​(int compressionLevel)
        Set the WebSocket compression level.
        Parameters:
        compressionLevel - the compression level
        Returns:
        a reference to this, so the API can be used fluently
      • isWebSocketAllowServerNoContext

        public boolean isWebSocketAllowServerNoContext()
        Returns:
        true when the WebSocket server will accept the server_no_context_takeover parameter for the per-message deflate compression extension offered by the client
      • setWebSocketAllowServerNoContext

        public MqttServerOptions setWebSocketAllowServerNoContext​(boolean accept)
        Set whether the WebSocket server will accept the server_no_context_takeover parameter of the per-message deflate compression extension offered by the client.
        Parameters:
        accept - true to accept the server_no_context_takeover parameter when the client offers it
        Returns:
        a reference to this, so the API can be used fluently
      • isWebSocketPreferredClientNoContext

        public boolean isWebSocketPreferredClientNoContext()
        Returns:
        true when the WebSocket server will accept the client_no_context_takeover parameter for the per-message deflate compression extension offered by the client
      • setWebSocketPreferredClientNoContext

        public MqttServerOptions setWebSocketPreferredClientNoContext​(boolean accept)
        Set whether the WebSocket server will accept the client_no_context_takeover parameter of the per-message deflate compression extension offered by the client.
        Parameters:
        accept - true to accept the client_no_context_takeover parameter when the client offers it
        Returns:
        a reference to this, so the API can be used fluently