Interface ModifiableOutboundDisconnectPacket
-
- All Superinterfaces:
DisconnectPacket
@DoNotImplement public interface ModifiableOutboundDisconnectPacket extends DisconnectPacket
An outboundDisconnectPacket
that can be modified before it is sent to the client.This packet is only used for MQTT 5 clients as MQTT 3.x does not support outbound disconnects.
- Since:
- 4.3.0, CE 2020.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull ModifiableUserProperties
getUserProperties()
The modifiableUserProperties
of the DISCONNECT packet.void
setReasonCode(@NotNull DisconnectReasonCode reasonCode)
Set theDisconnectReasonCode
of the DISCONNECT packet.void
setReasonString(@Nullable String reasonString)
Set the reason string of the DISCONNECT packet.void
setServerReference(@Nullable String serverReference)
Set the server reference of the DISCONNECT packet.-
Methods inherited from interface com.hivemq.extension.sdk.api.packets.disconnect.DisconnectPacket
getReasonCode, getReasonString, getServerReference, getSessionExpiryInterval
-
-
-
-
Method Detail
-
setReasonCode
void setReasonCode(@NotNull DisconnectReasonCode reasonCode)
Set theDisconnectReasonCode
of the DISCONNECT packet.- Parameters:
reasonCode
- The reason code to set.- Throws:
NullPointerException
- If the reason code isnull
.IllegalArgumentException
- If the disconnect reason code must not be used for outbound disconnect packets from the server to a client.- Since:
- 4.3.0, CE 2020.1
- See Also:
What reason codes exist for outbound disconnect packets from the server to a client.
-
setReasonString
void setReasonString(@Nullable String reasonString)
Set the reason string of the DISCONNECT packet.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 ornull
to remove the reason string.- Throws:
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.3.0, CE 2020.1
-
setServerReference
void setServerReference(@Nullable String serverReference)
Set the server reference of the DISCONNECT packet.This setting is only respected for MQTT 5 clients. For MQTT 3.x clients this setting is ignored.
- Parameters:
serverReference
- The server reference to set ornull
to remove the server reference.- 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.3.0, CE 2020.1
-
getUserProperties
@NotNull ModifiableUserProperties getUserProperties()
The modifiableUserProperties
of the DISCONNECT packet.- Specified by:
getUserProperties
in interfaceDisconnectPacket
- Returns:
- The modifiable user properties.
- Since:
- 4.3.0, CE 2020.1
-
-