Interface ModifiableConnackPacket
-
- All Superinterfaces:
ConnackPacket
public interface ModifiableConnackPacket extends ConnackPacket
AConnackPacket
that can be modified before it is sent to the client.- Since:
- 4.2.0, CE 2020.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull ModifiableUserProperties
getUserProperties()
Get the modifiableUserProperties
of the CONNACK packet.void
setReasonCode(@NotNull ConnackReasonCode reasonCode)
Set aConnackReasonCode
to the CONNACK packet.void
setReasonString(@Nullable String reasonString)
Set the reason string.void
setResponseInformation(@Nullable String responseInformation)
Set the response information.void
setServerReference(@Nullable String serverReference)
Set the server reference.-
Methods inherited from interface com.hivemq.extension.sdk.api.packets.connack.ConnackPacket
getAssignedClientIdentifier, getAuthenticationData, getAuthenticationMethod, getMaximumPacketSize, getMaximumQoS, getReasonCode, getReasonString, getReceiveMaximum, getResponseInformation, getRetainAvailable, getServerKeepAlive, getServerReference, getSessionExpiryInterval, getSessionPresent, getSharedSubscriptionsAvailable, getSubscriptionIdentifiersAvailable, getTopicAliasMaximum, getWildCardSubscriptionAvailable
-
-
-
-
Method Detail
-
setReasonCode
void setReasonCode(@NotNull ConnackReasonCode reasonCode)
Set aConnackReasonCode
to the CONNACK packet.Switching from successful to unsuccessful and vice versa is not supported.
- Parameters:
reasonCode
- The reason code to set.- Throws:
NullPointerException
- If reason code isnull
.IllegalStateException
- If switching from successful reason code to unsuccessful reason code or vice versa. Check outConnackReasonCode
to see what reason code counts as a success or unsuccessful code.- Since:
- 4.2.0, CE 2020.1
- See Also:
How reason codes are translated from MQTT 5 to MQTT 3.
-
setReasonString
void setReasonString(@Nullable String reasonString)
Set the reason string.A reason must not be set for a successful connack.
This setting is only respected for MQTT 5 clients. For MQTT 3.x clients this setting is ignored.
- Parameters:
reasonString
- The reason string to set.- Throws:
IllegalStateException
- If reason code isConnackReasonCode.SUCCESS
.IllegalArgumentException
- If the reason string is not a valid UTF-8 string.IllegalArgumentException
- If the reason string exceeds the UTF-8 string length limit.- Since:
- 4.2.0, CE 2020.1
-
getUserProperties
@NotNull ModifiableUserProperties getUserProperties()
Get the modifiableUserProperties
of the CONNACK packet.- Specified by:
getUserProperties
in interfaceConnackPacket
- Returns:
- Modifiable user properties.
- Since:
- 4.2.0, CE 2020.1
-
setResponseInformation
void setResponseInformation(@Nullable String responseInformation)
Set the response information.This setting is only respected for MQTT 5 clients. For MQTT 3.x clients this setting is ignored.
- Parameters:
responseInformation
- The new response information for the CONNACK.- Throws:
IllegalArgumentException
- If the response information is not a valid UTF-8 string.IllegalArgumentException
- If the response information exceeds the UTF-8 string length limit.IllegalStateException
- If the response information was not requested in the connect packet.- Since:
- 4.2.0, CE 2020.1
-
setServerReference
void setServerReference(@Nullable String serverReference)
Set the server reference.This setting is only respected for MQTT 5 clients. For MQTT 3.x clients this setting is ignored.
- Parameters:
serverReference
- The new server reference for the CONNACK.- Throws:
IllegalArgumentException
- If the server reference is not a valid UTF-8 string.IllegalArgumentException
- If the server reference exceeds the UTF-8 string length limit.- Since:
- 4.2.0, CE 2020.1
-
-