Class MqttServerOptions
java.lang.Object
io.vertx.core.net.NetworkOptions
io.vertx.core.net.TCPSSLOptions
io.vertx.core.net.NetServerOptions
io.vertx.mqtt.MqttServerOptions
Represents options used by the MQTT server
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanstatic final intstatic final intstatic final booleanstatic final booleanstatic final intstatic final intstatic final intstatic final booleanstatic final intstatic final booleanstatic final intstatic final booleanstatic final StringFields inherited from class NetServerOptions
DEFAULT_ACCEPT_BACKLOG, DEFAULT_HOST, DEFAULT_PROXY_PROTOCOL_TIMEOUT, DEFAULT_PROXY_PROTOCOL_TIMEOUT_TIME_UNIT, DEFAULT_REGISTER_WRITE_HANDLER, DEFAULT_USE_PROXY_PROTOCOLFields inherited from class TCPSSLOptions
DEFAULT_IDLE_TIMEOUT, DEFAULT_IDLE_TIMEOUT_TIME_UNIT, DEFAULT_READ_IDLE_TIMEOUT, DEFAULT_SO_LINGER, DEFAULT_SSL, DEFAULT_SSL_ENGINE, DEFAULT_TCP_CORK, DEFAULT_TCP_FAST_OPEN, DEFAULT_TCP_KEEAPLIVE_COUNT, DEFAULT_TCP_KEEAPLIVE_IDLE_SECONDS, DEFAULT_TCP_KEEAPLIVE_INTERVAL_SECONDS, DEFAULT_TCP_KEEP_ALIVE, DEFAULT_TCP_NO_DELAY, DEFAULT_TCP_QUICKACK, DEFAULT_TCP_USER_TIMEOUT, DEFAULT_WRITE_IDLE_TIMEOUT -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorMqttServerOptions(JsonObject json) Create an options from JSONCopy constructor -
Method Summary
Modifier and TypeMethodDescriptionaddCrlPath(String crlPath) Add a CRL pathaddCrlValue(Buffer crlValue) Add a CRL valueaddEnabledCipherSuite(String suite) Add an enabled cipher suite, appended to the ordered suites.addEnabledSecureTransportProtocol(String protocol) Add an enabled SSL/TLS protocols, appended to the ordered protocols.intintlongintintbooleanbooleanGet whether WebSocket the per-frame deflate compression extension is supported.booleanGet whether WebSocket the per-frame deflate compression extension is supported.booleanbooleanbooleanbooleansetAutoClientId(boolean isAutoClientId) Set if clientid should be auto-generated when it's "zero-bytes"setClientAuth(ClientAuth clientAuth) Set whether client auth is requiredSet the hostsetKeyCertOptions(KeyCertOptions options) Set the key/cert options.setMaxClientIdLength(int maxClientIdLength) Set the max client id length.setMaxMessageSize(int maxMessageSize) Set max MQTT message sizesetPerFrameWebSocketCompressionSupported(boolean supported) Enable or disable support for the WebSocket per-frame deflate compression extension.setPerMessageWebSocketCompressionSupported(boolean supported) Enable or disable support for WebSocket per-message deflate compression extension.setPort(int port) Set the portsetProxyProtocolTimeout(long proxyProtocolTimeout) Set the Proxy protocol timeout, default time unit is seconds.setProxyProtocolTimeoutUnit(TimeUnit proxyProtocolTimeoutUnit) Set the Proxy protocol timeout unit.setReceiveBufferSize(int receiveBufferSize) Set the TCP receive buffer sizesetSni(boolean sni) Set whether the server supports Server Name IndiciationsetSsl(boolean ssl) Set whether SSL/TLS is enabledsetTimeoutOnConnect(int timeoutOnConnect) Set the timeout on CONNECT packetsetTrustOptions(TrustOptions options) Set the trust options.setUseProxyProtocol(boolean useProxyProtocol) Set whether the server uses the HA Proxy protocolsetUseWebSocket(boolean useWebSocket) enable mqtt over websocketsetWebSocketAllowServerNoContext(boolean accept) Set whether the WebSocket server will accept theserver_no_context_takeoverparameter of the per-message deflate compression extension offered by the client.setWebSocketCompressionLevel(int compressionLevel) Set the WebSocket compression level.voidsetWebSocketMaxFrameSize(int webSocketMaxFrameSize) Set the WebSocket max frame size.setWebSocketPreferredClientNoContext(boolean accept) Set whether the WebSocket server will accept theclient_no_context_takeoverparameter of the per-message deflate compression extension offered by the client.inttoJson()Convert to JSONMethods inherited from class NetServerOptions
copy, createSSLOptions, getAcceptBacklog, getClientAuth, getHost, getOrCreateSSLOptions, getPort, getSslOptions, getTrafficShapingOptions, isFileRegionEnabled, isRegisterWriteHandler, isSni, removeEnabledCipherSuite, removeEnabledSecureTransportProtocol, setAcceptBacklog, setActivityLogDataFormat, setEnabledSecureTransportProtocols, setIdleTimeout, setIdleTimeoutUnit, setLogActivity, setReadIdleTimeout, setRegisterWriteHandler, setReuseAddress, setReusePort, setSendBufferSize, setSoLinger, setSslEngineOptions, setSslHandshakeTimeout, setSslHandshakeTimeoutUnit, setTcpCork, setTcpFastOpen, setTcpKeepAlive, setTcpNoDelay, setTcpQuickAck, setTcpUserTimeout, setTrafficClass, setTrafficShapingOptions, setUseAlpn, setWriteIdleTimeoutMethods inherited from class TCPSSLOptions
getCrlPaths, getCrlValues, getEnabledCipherSuites, getEnabledSecureTransportProtocols, getIdleTimeout, getIdleTimeoutUnit, getKeyCertOptions, getReadIdleTimeout, getReceiveBufferSize, getSendBufferSize, getSoLinger, getSslEngineOptions, getSslHandshakeTimeout, getSslHandshakeTimeoutUnit, getTcpKeepAliveCount, getTcpKeepAliveIdleSeconds, getTcpKeepAliveIntervalSeconds, getTcpUserTimeout, getTrafficClass, getTransportOptions, getTrustOptions, getWriteIdleTimeout, isReuseAddress, isReusePort, isSsl, isTcpCork, isTcpFastOpen, isTcpKeepAlive, isTcpNoDelay, isTcpQuickAck, isUseAlpn, setTcpKeepAliveCount, setTcpKeepAliveIdleSeconds, setTcpKeepAliveIntervalSecondsMethods inherited from class NetworkOptions
getActivityLogDataFormat, getLogActivity
-
Field Details
-
DEFAULT_PORT
public static final int DEFAULT_PORT- See Also:
-
DEFAULT_TLS_PORT
public static final int DEFAULT_TLS_PORT- See Also:
-
DEFAULT_MAX_MESSAGE_SIZE
public static final int DEFAULT_MAX_MESSAGE_SIZE- See Also:
-
DEFAULT_AUTO_CLIENT_ID
public static final boolean DEFAULT_AUTO_CLIENT_ID- See Also:
-
DEFAULT_MAX_CLIENT_ID_LENGTH
public static final int DEFAULT_MAX_CLIENT_ID_LENGTH- See Also:
-
DEFAULT_TIMEOUT_ON_CONNECT
public static final int DEFAULT_TIMEOUT_ON_CONNECT- See Also:
-
DEFAULT_USE_WEB_SOCKET
public static final boolean DEFAULT_USE_WEB_SOCKET- See Also:
-
DEFAULT_WEB_SOCKET_MAX_FRAME_SIZE
public static final int DEFAULT_WEB_SOCKET_MAX_FRAME_SIZE- See Also:
-
DEFAULT_PER_FRAME_WEBSOCKET_COMPRESSION_SUPPORTED
public static final boolean DEFAULT_PER_FRAME_WEBSOCKET_COMPRESSION_SUPPORTED- See Also:
-
DEFAULT_PER_MESSAGE_WEBSOCKET_COMPRESSION_SUPPORTED
public static final boolean DEFAULT_PER_MESSAGE_WEBSOCKET_COMPRESSION_SUPPORTED- See Also:
-
DEFAULT_WEBSOCKET_COMPRESSION_LEVEL
public static final int DEFAULT_WEBSOCKET_COMPRESSION_LEVEL- See Also:
-
DEFAULT_WEBSOCKET_ALLOW_SERVER_NO_CONTEXT
public static final boolean DEFAULT_WEBSOCKET_ALLOW_SERVER_NO_CONTEXT- See Also:
-
DEFAULT_WEBSOCKET_PREFERRED_CLIENT_NO_CONTEXT
public static final boolean DEFAULT_WEBSOCKET_PREFERRED_CLIENT_NO_CONTEXT- See Also:
-
MQTT_SUBPROTOCOL_CSV_LIST
- See Also:
-
-
Constructor Details
-
MqttServerOptions
public MqttServerOptions()Default constructor -
MqttServerOptions
-
MqttServerOptions
Copy constructor- Parameters:
other- the options to copy
-
-
Method Details
-
setPort
Description copied from class:NetServerOptionsSet the port- Overrides:
setPortin classNetServerOptions- Parameters:
port- the port- Returns:
- a reference to this, so the API can be used fluently
-
setHost
Description copied from class:NetServerOptionsSet the host- Overrides:
setHostin classNetServerOptions- Parameters:
host- the host- Returns:
- a reference to this, so the API can be used fluently
-
setClientAuth
Description copied from class:NetServerOptionsSet whether client auth is required- Overrides:
setClientAuthin classNetServerOptions- Parameters:
clientAuth- One of "NONE, REQUEST, REQUIRED". If it's set to "REQUIRED" then server will require the SSL cert to be presented otherwise it won't accept the request. If it's set to "REQUEST" then it won't mandate the certificate to be presented, basically make it optional.- Returns:
- a reference to this, so the API can be used fluently
-
setSsl
Description copied from class:TCPSSLOptionsSet whether SSL/TLS is enabled- Overrides:
setSslin classNetServerOptions- Parameters:
ssl- true if enabled- Returns:
- a reference to this, so the API can be used fluently
-
setKeyCertOptions
Description copied from class:TCPSSLOptionsSet the key/cert options.- Overrides:
setKeyCertOptionsin classNetServerOptions- Parameters:
options- the key store options- Returns:
- a reference to this, so the API can be used fluently
-
setTrustOptions
Description copied from class:TCPSSLOptionsSet the trust options.- Overrides:
setTrustOptionsin classNetServerOptions- Parameters:
options- the trust options- Returns:
- a reference to this, so the API can be used fluently
-
addEnabledCipherSuite
Description copied from class:TCPSSLOptionsAdd an enabled cipher suite, appended to the ordered suites.- Overrides:
addEnabledCipherSuitein classNetServerOptions- Parameters:
suite- the suite- Returns:
- a reference to this, so the API can be used fluently
- See Also:
-
addEnabledSecureTransportProtocol
Description copied from class:TCPSSLOptionsAdd an enabled SSL/TLS protocols, appended to the ordered protocols.- Overrides:
addEnabledSecureTransportProtocolin classNetServerOptions- Parameters:
protocol- the SSL/TLS protocol to enable- Returns:
- a reference to this, so the API can be used fluently
-
addCrlPath
Description copied from class:TCPSSLOptionsAdd a CRL path- Overrides:
addCrlPathin classNetServerOptions- Parameters:
crlPath- the path- Returns:
- a reference to this, so the API can be used fluently
- Throws:
NullPointerException
-
addCrlValue
Description copied from class:TCPSSLOptionsAdd a CRL value- Overrides:
addCrlValuein classNetServerOptions- Parameters:
crlValue- the value- Returns:
- a reference to this, so the API can be used fluently
- Throws:
NullPointerException
-
setReceiveBufferSize
Description copied from class:NetworkOptionsSet the TCP receive buffer size- Overrides:
setReceiveBufferSizein classNetServerOptions- Parameters:
receiveBufferSize- the buffers size, in bytes- Returns:
- a reference to this, so the API can be used fluently
-
setSni
Description copied from class:NetServerOptionsSet whether the server supports Server Name Indiciation- Overrides:
setSniin classNetServerOptions- Returns:
- a reference to this, so the API can be used fluently
-
setMaxMessageSize
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
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
Set the max client id length.- Parameters:
maxClientIdLength- the new value- Returns:
- MQTT server options instance
-
setTimeoutOnConnect
Set the timeout on CONNECT packet- Parameters:
timeoutOnConnect- timeout on CONNECT before closing connection- Returns:
- MQTT server options instance
-
setUseProxyProtocol
Description copied from class:NetServerOptionsSet whether the server uses the HA Proxy protocol- Overrides:
setUseProxyProtocolin classNetServerOptions- Returns:
- a reference to this, so the API can be used fluently
-
isUseProxyProtocol
public boolean isUseProxyProtocol()- Overrides:
isUseProxyProtocolin classNetServerOptions- Returns:
- whether the server uses the HA Proxy protocol
-
getProxyProtocolTimeout
public long getProxyProtocolTimeout()- Overrides:
getProxyProtocolTimeoutin classNetServerOptions- Returns:
- the Proxy protocol timeout, in time unit specified by
NetServerOptions.getProxyProtocolTimeoutUnit().
-
setProxyProtocolTimeout
Description copied from class:NetServerOptionsSet the Proxy protocol timeout, default time unit is seconds.- Overrides:
setProxyProtocolTimeoutin classNetServerOptions- Parameters:
proxyProtocolTimeout- the Proxy protocol timeout to set- Returns:
- a reference to this, so the API can be used fluently
-
setProxyProtocolTimeoutUnit
Description copied from class:NetServerOptionsSet the Proxy protocol timeout unit. If not specified, default is seconds.- Overrides:
setProxyProtocolTimeoutUnitin classNetServerOptions- Parameters:
proxyProtocolTimeoutUnit- specify time unit.- Returns:
- a reference to this, so the API can be used fluently
-
getProxyProtocolTimeoutUnit
- Overrides:
getProxyProtocolTimeoutUnitin classNetServerOptions- Returns:
- the Proxy protocol timeout unit.
-
timeoutOnConnect
public int timeoutOnConnect()- Returns:
- timeout on CONNECT before closing connection
-
setUseWebSocket
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
maxMessageSizeis 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:
trueif the http server will accept the per-frame deflate compression extension
-
setPerFrameWebSocketCompressionSupported
Enable or disable support for the WebSocket per-frame deflate compression extension.- Parameters:
supported-truewhen 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:
trueif the http server will accept the per-frame deflate compression extension
-
setPerMessageWebSocketCompressionSupported
Enable or disable support for WebSocket per-message deflate compression extension.- Parameters:
supported-truewhen 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
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:
truewhen the WebSocket server will accept theserver_no_context_takeoverparameter for the per-message deflate compression extension offered by the client
-
setWebSocketAllowServerNoContext
Set whether the WebSocket server will accept theserver_no_context_takeoverparameter of the per-message deflate compression extension offered by the client.- Parameters:
accept-trueto 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:
truewhen the WebSocket server will accept theclient_no_context_takeoverparameter for the per-message deflate compression extension offered by the client
-
setWebSocketPreferredClientNoContext
Set whether the WebSocket server will accept theclient_no_context_takeoverparameter of the per-message deflate compression extension offered by the client.- Parameters:
accept-trueto accept theclient_no_context_takeoverparameter when the client offers it- Returns:
- a reference to this, so the API can be used fluently
-
toJson
Description copied from class:NetServerOptionsConvert to JSON- Overrides:
toJsonin classNetServerOptions- Returns:
- the JSON
-