Interface ModifiableOutboundDisconnectPacket
- All Superinterfaces:
DisconnectPacket
@DoNotImplement public interface ModifiableOutboundDisconnectPacket extends DisconnectPacket
An outbound
DisconnectPacket 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
Modifier and Type Method Description @NotNull ModifiableUserPropertiesgetUserProperties()The modifiableUserPropertiesof the DISCONNECT packet.voidsetReasonCode(@NotNull DisconnectReasonCode reasonCode)Set theDisconnectReasonCodeof the DISCONNECT packet.voidsetReasonString(@Nullable String reasonString)Set the reason string of the DISCONNECT packet.voidsetServerReference(@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 Details
-
setReasonCode
Set theDisconnectReasonCodeof 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
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 ornullto 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
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 ornullto 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
The modifiableUserPropertiesof the DISCONNECT packet.- Specified by:
getUserPropertiesin interfaceDisconnectPacket- Returns:
- The modifiable user properties.
- Since:
- 4.3.0, CE 2020.1
-