Interface ConnectPacket
-
- All Known Subinterfaces:
ModifiableConnectPacket
@DoNotImplement @Immutable public interface ConnectPacket
Contains all information from a CONNECT packet.- Since:
- 4.0.0, CE 2019.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull Optional<@Immutable ByteBuffer>getAuthenticationData()If this property is present, theByteBuffercontains the data used for the extended authentication.@NotNull Optional<String>getAuthenticationMethod()If this property is present, the string contains the authentication method that should be used for the extended authentication.booleangetCleanStart()Flag that indicates if the existing session for the client should be continued (false) or the existing session should be overwritten (true).@NotNull StringgetClientId()The client identifier the client wants to use.intgetKeepAlive()An interval in seconds in which the client has to send any MQTT control packet, so that HiveMQ doesn't end the connection.longgetMaximumPacketSize()The maximum packet size in bytes for an MQTT Control Packet, the client is willing to accept.@NotNull MqttVersiongetMqttVersion()TheMqttVersionthe clients wants to use for the connection.@NotNull Optional<@Immutable ByteBuffer>getPassword()If this property is present, this is the password for the client.intgetReceiveMaximum()The limit of QoS 1 and QoS 2Publishes that the client is willing to process concurrently.booleangetRequestProblemInformation()This flag indicates if the server may sent Reason String or User Properties in the case of failures.booleangetRequestResponseInformation()This flag indicates if the client wants to receive Response Information in the CONNACK packet (true) or not (false).longgetSessionExpiryInterval()Duration in seconds how long session for the client is stored.intgetTopicAliasMaximum()The maximum amount of topic alias the client allows for this connection.@NotNull Optional<String>getUserName()If this property is present, this is the username for the client.@NotNull UserPropertiesgetUserProperties()The user properties from the CONNECT packet.@NotNull Optional<WillPublishPacket>getWillPublish()Contains theWillPublishPacketif it was sent in the CONNECT packet.
-
-
-
Method Detail
-
getMqttVersion
@NotNull MqttVersion getMqttVersion()
TheMqttVersionthe clients wants to use for the connection.- Returns:
- The MQTT version.
- Since:
- 4.0.0, CE 2019.1
-
getClientId
@NotNull String getClientId()
The client identifier the client wants to use.An MQTT 5 client may send an empty string.
- Returns:
- The client identifier.
- Since:
- 4.0.0, CE 2019.1
-
getCleanStart
boolean getCleanStart()
Flag that indicates if the existing session for the client should be continued (false) or the existing session should be overwritten (true). Has no effect if no session for the client exists.For an MQTT 3 client, this MQTT 5 property can be interpreted as followed:
- cleanSession = true -> cleanStart = true
- cleanSession = false -> cleanStart = false
- Returns:
- The clean start flag.
- Since:
- 4.0.0, CE 2019.1
-
getWillPublish
@NotNull Optional<WillPublishPacket> getWillPublish()
Contains theWillPublishPacketif it was sent in the CONNECT packet.- Returns:
- An
Optionalthat contains theWillPublishPacketif present. - Since:
- 4.0.0, CE 2019.1
-
getSessionExpiryInterval
long getSessionExpiryInterval()
Duration in seconds how long session for the client is stored.For an MQTT 3 client, this MQTT 5 property can be interpreted as followed:
- cleanSession = true -> sessionExpiryInterval = 0
- cleanSession = false -> sessionExpiryInterval = The configured
<session-expiry>in the<mqtt>config in the config.xml. Default: 4294967295
- Returns:
- The session expiry interval.
- Since:
- 4.0.0, CE 2019.1
-
getKeepAlive
int getKeepAlive()
An interval in seconds in which the client has to send any MQTT control packet, so that HiveMQ doesn't end the connection.- Returns:
- The keep alive.
- Since:
- 4.0.0, CE 2019.1
-
getReceiveMaximum
int getReceiveMaximum()
The limit of QoS 1 and QoS 2Publishes that the client is willing to process concurrently.For an MQTT 3 client this MQTT 5 property will always be 65,535.
- Returns:
- The receive maximum.
- Since:
- 4.0.0, CE 2019.1
-
getMaximumPacketSize
long getMaximumPacketSize()
The maximum packet size in bytes for an MQTT Control Packet, the client is willing to accept.For an MQTT 3 client this MQTT 5 property will always be 268435460 bytes (protocol limit for the packet size).
- Returns:
- The maximum packet size.
- Since:
- 4.0.0, CE 2019.1
-
getTopicAliasMaximum
int getTopicAliasMaximum()
The maximum amount of topic alias the client allows for this connection.For an MQTT 3 client this MQTT 5 property will always be 0.
- Returns:
- The topic alias maximum.
- Since:
- 4.0.0, CE 2019.1
-
getRequestResponseInformation
boolean getRequestResponseInformation()
This flag indicates if the client wants to receive Response Information in the CONNACK packet (true) or not (false).For an MQTT 3 client this MQTT 5 property will always be false.
- Returns:
- The request response information flag.
- Since:
- 4.0.0, CE 2019.1
-
getRequestProblemInformation
boolean getRequestProblemInformation()
This flag indicates if the server may sent Reason String or User Properties in the case of failures. Iftrueserver may sent these in any MQTT packet, forfalsethey may only be sent in a PUBLISH, CONNACK, or DISCONNECT packet.For an MQTT 3 client this MQTT 5 property will always be false. This can be ignored for MQTT 3 clients.
- Returns:
- The request problem information flag.
- Since:
- 4.0.0, CE 2019.1
-
getAuthenticationMethod
@NotNull Optional<String> getAuthenticationMethod()
If this property is present, the string contains the authentication method that should be used for the extended authentication.For an MQTT 3 client this property can be set in the
ConnectInboundInterceptor.- Returns:
- An
Optionalthat contains the authentication method if present. - Since:
- 4.0.0, CE 2019.1
-
getAuthenticationData
@NotNull Optional<@Immutable ByteBuffer> getAuthenticationData()
If this property is present, theByteBuffercontains the data used for the extended authentication. The contents of this data are defined by the authentication method.For an MQTT 3 client this property can be set in the
ConnectInboundInterceptor.The ByteBuffer returned by this method is
read onlyand will throw aReadOnlyBufferExceptionif handled incorrectly.- Returns:
- An
Optionalthat contains the authentication data if present. - Since:
- 4.0.0, CE 2019.1
-
getUserProperties
@NotNull UserProperties getUserProperties()
The user properties from the CONNECT packet.For an MQTT 3 client this property can be set in the
ConnectInboundInterceptor.- Returns:
- The user properties.
- Since:
- 4.0.0, CE 2019.1
-
getUserName
@NotNull Optional<String> getUserName()
If this property is present, this is the username for the client.- Returns:
- An
Optionalthat contains the username if present. - Since:
- 4.0.0, CE 2019.1
-
getPassword
@NotNull Optional<@Immutable ByteBuffer> getPassword()
If this property is present, this is the password for the client.The ByteBuffer returned by this method is
read onlyand will throw aReadOnlyBufferExceptionif handled incorrectly.- Returns:
- An
Optionalthat contains the password if present. - Since:
- 4.0.0, CE 2019.1
-
-