public class MqttServerOptions extends NetServerOptions
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_AUTO_CLIENT_ID |
static int |
DEFAULT_MAX_CLIENT_ID_LENGTH |
static int |
DEFAULT_MAX_MESSAGE_SIZE |
static boolean |
DEFAULT_PER_FRAME_WEBSOCKET_COMPRESSION_SUPPORTED |
static boolean |
DEFAULT_PER_MESSAGE_WEBSOCKET_COMPRESSION_SUPPORTED |
static int |
DEFAULT_PORT |
static int |
DEFAULT_TIMEOUT_ON_CONNECT |
static int |
DEFAULT_TLS_PORT |
static boolean |
DEFAULT_USE_WEB_SOCKET |
static int |
DEFAULT_WEB_SOCKET_MAX_FRAME_SIZE |
static boolean |
DEFAULT_WEBSOCKET_ALLOW_SERVER_NO_CONTEXT |
static int |
DEFAULT_WEBSOCKET_COMPRESSION_LEVEL |
static boolean |
DEFAULT_WEBSOCKET_PREFERRED_CLIENT_NO_CONTEXT |
static String |
MQTT_SUBPROTOCOL_CSV_LIST |
DEFAULT_ACCEPT_BACKLOG, DEFAULT_CLIENT_AUTH, DEFAULT_HOST, DEFAULT_PROXY_PROTOCOL_TIMEOUT, DEFAULT_PROXY_PROTOCOL_TIMEOUT_TIME_UNIT, DEFAULT_REGISTER_WRITE_HANDLER, DEFAULT_SNI, DEFAULT_USE_PROXY_PROTOCOL
DEFAULT_ENABLED_SECURE_TRANSPORT_PROTOCOLS, DEFAULT_IDLE_TIMEOUT, DEFAULT_IDLE_TIMEOUT_TIME_UNIT, DEFAULT_READ_IDLE_TIMEOUT, DEFAULT_SO_LINGER, DEFAULT_SSL, DEFAULT_SSL_ENGINE, DEFAULT_SSL_HANDSHAKE_TIMEOUT, DEFAULT_SSL_HANDSHAKE_TIMEOUT_TIME_UNIT, DEFAULT_TCP_CORK, DEFAULT_TCP_FAST_OPEN, DEFAULT_TCP_KEEP_ALIVE, DEFAULT_TCP_NO_DELAY, DEFAULT_TCP_QUICKACK, DEFAULT_TCP_USER_TIMEOUT, DEFAULT_USE_ALPN, DEFAULT_WRITE_IDLE_TIMEOUT
DEFAULT_LOG_ACTIVITY_FORMAT, DEFAULT_LOG_ENABLED, DEFAULT_RECEIVE_BUFFER_SIZE, DEFAULT_REUSE_ADDRESS, DEFAULT_REUSE_PORT, DEFAULT_SEND_BUFFER_SIZE, DEFAULT_TRAFFIC_CLASS
Constructor and Description |
---|
MqttServerOptions()
Default constructor
|
MqttServerOptions(JsonObject json)
Create an options from JSON
|
MqttServerOptions(MqttServerOptions other)
Copy constructor
|
Modifier and Type | Method and Description |
---|---|
MqttServerOptions |
addCrlPath(String crlPath)
Add a CRL path
|
MqttServerOptions |
addCrlValue(Buffer crlValue)
Add a CRL value
|
MqttServerOptions |
addEnabledCipherSuite(String suite)
Add an enabled cipher suite, appended to the ordered suites.
|
MqttServerOptions |
addEnabledSecureTransportProtocol(String protocol)
Add an enabled SSL/TLS protocols, appended to the ordered protocols.
|
int |
getMaxClientIdLength() |
int |
getMaxMessageSize() |
long |
getProxyProtocolTimeout() |
TimeUnit |
getProxyProtocolTimeoutUnit() |
int |
getWebSocketCompressionLevel() |
int |
getWebSocketMaxFrameSize() |
boolean |
isAutoClientId() |
boolean |
isPerFrameWebSocketCompressionSupported()
Get whether WebSocket the per-frame deflate compression extension is supported.
|
boolean |
isPerMessageWebSocketCompressionSupported()
Get whether WebSocket the per-frame deflate compression extension is supported.
|
boolean |
isUseProxyProtocol() |
boolean |
isUseWebSocket() |
boolean |
isWebSocketAllowServerNoContext() |
boolean |
isWebSocketPreferredClientNoContext() |
MqttServerOptions |
setAutoClientId(boolean isAutoClientId)
Set if clientid should be auto-generated when it's "zero-bytes"
|
MqttServerOptions |
setClientAuth(ClientAuth clientAuth)
Set whether client auth is required
|
MqttServerOptions |
setHost(String host)
Set the host
|
MqttServerOptions |
setKeyCertOptions(KeyCertOptions options)
Set the key/cert options.
|
MqttServerOptions |
setKeyStoreOptions(JksOptions options)
Set the key/cert options in jks format, aka Java keystore.
|
MqttServerOptions |
setMaxClientIdLength(int maxClientIdLength)
Set the max client id length.
|
MqttServerOptions |
setMaxMessageSize(int maxMessageSize)
Set max MQTT message size
|
MqttServerOptions |
setPemKeyCertOptions(PemKeyCertOptions options)
Set the key/cert store options in pem format.
|
MqttServerOptions |
setPemTrustOptions(PemTrustOptions options)
Set the trust options in pem format
|
MqttServerOptions |
setPerFrameWebSocketCompressionSupported(boolean supported)
Enable or disable support for the WebSocket per-frame deflate compression extension.
|
MqttServerOptions |
setPerMessageWebSocketCompressionSupported(boolean supported)
Enable or disable support for WebSocket per-message deflate compression extension.
|
MqttServerOptions |
setPfxKeyCertOptions(PfxOptions options)
Set the key/cert options in pfx format.
|
MqttServerOptions |
setPfxTrustOptions(PfxOptions options)
Set the trust options in pfx format
|
MqttServerOptions |
setPort(int port)
Set the port
|
MqttServerOptions |
setProxyProtocolTimeout(long proxyProtocolTimeout)
Set the Proxy protocol timeout, default time unit is seconds.
|
MqttServerOptions |
setProxyProtocolTimeoutUnit(TimeUnit proxyProtocolTimeoutUnit)
Set the Proxy protocol timeout unit.
|
MqttServerOptions |
setReceiveBufferSize(int receiveBufferSize)
Set the TCP receive buffer size
|
MqttServerOptions |
setSni(boolean sni)
Set whether the server supports Server Name Indiciation
|
MqttServerOptions |
setSsl(boolean ssl)
Set whether SSL/TLS is enabled
|
MqttServerOptions |
setTimeoutOnConnect(int timeoutOnConnect)
Set the timeout on CONNECT packet
|
MqttServerOptions |
setTrustOptions(TrustOptions options)
Set the trust options.
|
MqttServerOptions |
setTrustStoreOptions(JksOptions options)
Set the trust options in jks format, aka Java truststore
|
MqttServerOptions |
setUseProxyProtocol(boolean useProxyProtocol)
Set whether the server uses the HA Proxy protocol
|
MqttServerOptions |
setUseWebSocket(boolean useWebSocket)
enable mqtt over websocket
|
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. |
MqttServerOptions |
setWebSocketCompressionLevel(int compressionLevel)
Set the WebSocket compression level.
|
void |
setWebSocketMaxFrameSize(int webSocketMaxFrameSize)
Set the WebSocket max frame size.
|
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. |
int |
timeoutOnConnect() |
JsonObject |
toJson()
Convert to JSON
|
getAcceptBacklog, getClientAuth, getHost, getPort, isRegisterWriteHandler, isSni, removeEnabledCipherSuite, removeEnabledSecureTransportProtocol, setAcceptBacklog, setActivityLogDataFormat, setEnabledSecureTransportProtocols, setIdleTimeout, setIdleTimeoutUnit, setJdkSslEngineOptions, setLogActivity, setOpenSslEngineOptions, setReadIdleTimeout, setRegisterWriteHandler, setReuseAddress, setReusePort, setSendBufferSize, setSoLinger, setSslEngineOptions, setSslHandshakeTimeout, setSslHandshakeTimeoutUnit, setTcpCork, setTcpFastOpen, setTcpKeepAlive, setTcpNoDelay, setTcpQuickAck, setTrafficClass, setUseAlpn, setWriteIdleTimeout
getCrlPaths, getCrlValues, getEnabledCipherSuites, getEnabledSecureTransportProtocols, getIdleTimeout, getIdleTimeoutUnit, getJdkSslEngineOptions, getKeyCertOptions, getKeyStoreOptions, getOpenSslEngineOptions, getPemKeyCertOptions, getPemTrustOptions, getPfxKeyCertOptions, getPfxTrustOptions, getReadIdleTimeout, getSoLinger, getSslEngineOptions, getSslHandshakeTimeout, getSslHandshakeTimeoutUnit, getSslOptions, getTcpUserTimeout, getTrustOptions, getTrustStoreOptions, getWriteIdleTimeout, isSsl, isTcpCork, isTcpFastOpen, isTcpKeepAlive, isTcpNoDelay, isTcpQuickAck, isUseAlpn, setTcpUserTimeout
getActivityLogDataFormat, getLogActivity, getReceiveBufferSize, getSendBufferSize, getTrafficClass, isReuseAddress, isReusePort
public static final int DEFAULT_PORT
public static final int DEFAULT_TLS_PORT
public static final int DEFAULT_MAX_MESSAGE_SIZE
public static final boolean DEFAULT_AUTO_CLIENT_ID
public static final int DEFAULT_MAX_CLIENT_ID_LENGTH
public static final int DEFAULT_TIMEOUT_ON_CONNECT
public static final boolean DEFAULT_USE_WEB_SOCKET
public static final int DEFAULT_WEB_SOCKET_MAX_FRAME_SIZE
public static final boolean DEFAULT_PER_FRAME_WEBSOCKET_COMPRESSION_SUPPORTED
public static final boolean DEFAULT_PER_MESSAGE_WEBSOCKET_COMPRESSION_SUPPORTED
public static final int DEFAULT_WEBSOCKET_COMPRESSION_LEVEL
public static final boolean DEFAULT_WEBSOCKET_ALLOW_SERVER_NO_CONTEXT
public static final boolean DEFAULT_WEBSOCKET_PREFERRED_CLIENT_NO_CONTEXT
public static final String MQTT_SUBPROTOCOL_CSV_LIST
public MqttServerOptions()
public MqttServerOptions(JsonObject json)
json
- the JSONpublic MqttServerOptions(MqttServerOptions other)
other
- the options to copypublic MqttServerOptions setPort(int port)
NetServerOptions
setPort
in class NetServerOptions
port
- the portpublic MqttServerOptions setHost(String host)
NetServerOptions
setHost
in class NetServerOptions
host
- the hostpublic MqttServerOptions setClientAuth(ClientAuth clientAuth)
NetServerOptions
setClientAuth
in class NetServerOptions
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.public MqttServerOptions setSsl(boolean ssl)
TCPSSLOptions
setSsl
in class NetServerOptions
ssl
- true if enabledpublic MqttServerOptions setKeyCertOptions(KeyCertOptions options)
TCPSSLOptions
setKeyCertOptions
in class NetServerOptions
options
- the key store optionspublic MqttServerOptions setKeyStoreOptions(JksOptions options)
TCPSSLOptions
setKeyStoreOptions
in class NetServerOptions
options
- the key store in jks formatpublic MqttServerOptions setPfxKeyCertOptions(PfxOptions options)
TCPSSLOptions
setPfxKeyCertOptions
in class NetServerOptions
options
- the key cert options in pfx formatpublic MqttServerOptions setPemKeyCertOptions(PemKeyCertOptions options)
TCPSSLOptions
setPemKeyCertOptions
in class NetServerOptions
options
- the options in pem formatpublic MqttServerOptions setTrustOptions(TrustOptions options)
TCPSSLOptions
setTrustOptions
in class NetServerOptions
options
- the trust optionspublic MqttServerOptions setTrustStoreOptions(JksOptions options)
TCPSSLOptions
setTrustStoreOptions
in class NetServerOptions
options
- the trust options in jks formatpublic MqttServerOptions setPemTrustOptions(PemTrustOptions options)
TCPSSLOptions
setPemTrustOptions
in class NetServerOptions
options
- the trust options in pem formatpublic MqttServerOptions setPfxTrustOptions(PfxOptions options)
TCPSSLOptions
setPfxTrustOptions
in class NetServerOptions
options
- the trust options in pfx formatpublic MqttServerOptions addEnabledCipherSuite(String suite)
TCPSSLOptions
addEnabledCipherSuite
in class NetServerOptions
suite
- the suiteTCPSSLOptions.getEnabledCipherSuites()
public MqttServerOptions addEnabledSecureTransportProtocol(String protocol)
TCPSSLOptions
addEnabledSecureTransportProtocol
in class NetServerOptions
protocol
- the SSL/TLS protocol to enablepublic MqttServerOptions addCrlPath(String crlPath) throws NullPointerException
TCPSSLOptions
addCrlPath
in class NetServerOptions
crlPath
- the pathNullPointerException
public MqttServerOptions addCrlValue(Buffer crlValue) throws NullPointerException
TCPSSLOptions
addCrlValue
in class NetServerOptions
crlValue
- the valueNullPointerException
public MqttServerOptions setReceiveBufferSize(int receiveBufferSize)
NetworkOptions
setReceiveBufferSize
in class NetServerOptions
receiveBufferSize
- the buffers size, in bytespublic MqttServerOptions setSni(boolean sni)
NetServerOptions
setSni
in class NetServerOptions
public MqttServerOptions setMaxMessageSize(int maxMessageSize)
maxMessageSize
- max MQTT message size (variable header + payload)public int getMaxMessageSize()
public MqttServerOptions setAutoClientId(boolean isAutoClientId)
isAutoClientId
- public boolean isAutoClientId()
public int getMaxClientIdLength()
public MqttServerOptions setMaxClientIdLength(int maxClientIdLength)
maxClientIdLength
- the new valuepublic MqttServerOptions setTimeoutOnConnect(int timeoutOnConnect)
timeoutOnConnect
- timeout on CONNECT before closing connectionpublic MqttServerOptions setUseProxyProtocol(boolean useProxyProtocol)
NetServerOptions
setUseProxyProtocol
in class NetServerOptions
public boolean isUseProxyProtocol()
isUseProxyProtocol
in class NetServerOptions
public long getProxyProtocolTimeout()
getProxyProtocolTimeout
in class NetServerOptions
NetServerOptions.getProxyProtocolTimeoutUnit()
.public MqttServerOptions setProxyProtocolTimeout(long proxyProtocolTimeout)
NetServerOptions
setProxyProtocolTimeout
in class NetServerOptions
proxyProtocolTimeout
- the Proxy protocol timeout to setpublic MqttServerOptions setProxyProtocolTimeoutUnit(TimeUnit proxyProtocolTimeoutUnit)
NetServerOptions
setProxyProtocolTimeoutUnit
in class NetServerOptions
proxyProtocolTimeoutUnit
- specify time unit.public TimeUnit getProxyProtocolTimeoutUnit()
getProxyProtocolTimeoutUnit
in class NetServerOptions
public int timeoutOnConnect()
public MqttServerOptions setUseWebSocket(boolean useWebSocket)
useWebSocket
- use mqtt over websocketpublic boolean isUseWebSocket()
public int getWebSocketMaxFrameSize()
public void setWebSocketMaxFrameSize(int webSocketMaxFrameSize)
This should be used when WebSocket transport is used and maxMessageSize
is larger than the WebSocket frame size
webSocketMaxFrameSize
- the new frame sizepublic boolean isPerFrameWebSocketCompressionSupported()
true
if the http server will accept the per-frame deflate compression extensionpublic MqttServerOptions setPerFrameWebSocketCompressionSupported(boolean supported)
supported
- true
when the per-frame deflate compression extension is supportedpublic boolean isPerMessageWebSocketCompressionSupported()
true
if the http server will accept the per-frame deflate compression extensionpublic MqttServerOptions setPerMessageWebSocketCompressionSupported(boolean supported)
supported
- true
when the per-message WebSocket compression extension is supportedpublic int getWebSocketCompressionLevel()
public MqttServerOptions setWebSocketCompressionLevel(int compressionLevel)
compressionLevel
- the compression levelpublic boolean isWebSocketAllowServerNoContext()
true
when the WebSocket server will accept the server_no_context_takeover
parameter for the per-message
deflate compression extension offered by the clientpublic MqttServerOptions setWebSocketAllowServerNoContext(boolean accept)
server_no_context_takeover
parameter of the per-message
deflate compression extension offered by the client.accept
- true
to accept the server_no_context_takeover parameter when the client offers itpublic boolean isWebSocketPreferredClientNoContext()
true
when the WebSocket server will accept the client_no_context_takeover
parameter for the per-message
deflate compression extension offered by the clientpublic MqttServerOptions setWebSocketPreferredClientNoContext(boolean accept)
client_no_context_takeover
parameter of the per-message
deflate compression extension offered by the client.accept
- true
to accept the client_no_context_takeover
parameter when the client offers itpublic JsonObject toJson()
NetServerOptions
toJson
in class NetServerOptions
Copyright © 2023 Eclipse. All rights reserved.