Class ConnectPacket


  • public class ConnectPacket
    extends java.lang.Object
    Data model of an MQTT5 CONNECT packet.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  ConnectPacket.ConnectPacketBuilder
      A class to that allows for the creation of a ConnectPacket.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getClientId()
      Returns a unique string identifying the client to the server.
      java.lang.Long getKeepAliveIntervalSeconds()
      Returns the maximum time interval, in seconds, that is permitted to elapse between the point at which the client finishes transmitting one MQTT packet and the point it starts sending the next.
      java.lang.Long getMaximumPacketSizeBytes()
      Returns the maximum packet size the client is willing to handle.
      byte[] getPassword()
      Returns opaque binary data that the server may use for client authentication and authorization.
      java.lang.Long getReceiveMaximum()
      Returns the maximum number of in-flight QoS 1 and 2 messages the client is willing to handle.
      java.lang.Boolean getRequestProblemInformation()
      Returns a boolean that, if true, requests that the server send additional diagnostic information (via response string or user properties) in DisconnectPacket or ConnAckPacket from the server.
      java.lang.Boolean getRequestResponseInformation()
      Returns a boolean that, if true, requests that the server send response information in the subsequent ConnAckPacket.
      java.lang.Long getSessionExpiryIntervalSeconds()
      Returns a time interval, in seconds, that the client requests the server to persist this connection's MQTT session state for.
      java.lang.String getUsername()
      Returns a string value that the server may use for client authentication and authorization.
      java.util.List<UserProperty> getUserProperties()
      Returns a list of MQTT5 user properties included with the packet.
      PublishPacket getWill()
      Returns the definition of a message to be published when the connection's session is destroyed by the server or when the will delay interval has elapsed, whichever comes first.
      java.lang.Long getWillDelayIntervalSeconds()
      Returns a time interval, in seconds, that the server should wait (for a session reconnection) before sending the will message associated with the connection's session.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getKeepAliveIntervalSeconds

        public java.lang.Long getKeepAliveIntervalSeconds()
        Returns the maximum time interval, in seconds, that is permitted to elapse between the point at which the client finishes transmitting one MQTT packet and the point it starts sending the next. The client will use PINGREQ packets to maintain this property. If the responding ConnAckPacket contains a keep alive property value, then that is the negotiated keep alive value. Otherwise, the keep alive sent by the client is the negotiated value. See MQTT5 Keep Alive
        Returns:
        The maximum time interval, in seconds, that is permitted to elapse between the point at which the client finishes transmitting one MQTT packet and the point it starts sending the next.
      • getClientId

        public java.lang.String getClientId()
        Returns a unique string identifying the client to the server. Used to restore session state between connections. If left empty, the broker will auto-assign a unique client id. When reconnecting, the Mqtt5Client will always use the auto-assigned client id. See MQTT5 Client Identifier
        Returns:
        A unique string identifying the client to the server.
      • getUsername

        public java.lang.String getUsername()
        Returns a string value that the server may use for client authentication and authorization. See MQTT5 User Name
        Returns:
        A string value that the server may use for client authentication and authorization.
      • getPassword

        public byte[] getPassword()
        Returns opaque binary data that the server may use for client authentication and authorization. See MQTT5 Password
        Returns:
        Opaque binary data that the server may use for client authentication and authorization.
      • getSessionExpiryIntervalSeconds

        public java.lang.Long getSessionExpiryIntervalSeconds()
        Returns a time interval, in seconds, that the client requests the server to persist this connection's MQTT session state for. Has no meaning if the client has not been configured to rejoin sessions. Must be non-zero in order to successfully rejoin a session. If the responding ConnAckPacket contains a session expiry property value, then that is the negotiated session expiry value. Otherwise, the session expiry sent by the client is the negotiated value. See MQTT5 Session Expiry Interval
        Returns:
        A time interval, in seconds, that the client requests the server to persist this connection's MQTT session state for.
      • getRequestResponseInformation

        public java.lang.Boolean getRequestResponseInformation()
        Returns a boolean that, if true, requests that the server send response information in the subsequent ConnAckPacket. This response information may be used to set up request-response implementations over MQTT, but doing so is outside the scope of the MQTT5 spec and client. See MQTT5 Request Response Information
        Returns:
        If true, requests that the server send response information in the subsequent ConnAckPacket.
      • getRequestProblemInformation

        public java.lang.Boolean getRequestProblemInformation()
        Returns a boolean that, if true, requests that the server send additional diagnostic information (via response string or user properties) in DisconnectPacket or ConnAckPacket from the server. See MQTT5 Request Problem Information
        Returns:
        If true, requests that the server send additional diagnostic information (via response string or user properties) in DisconnectPacket or ConnAckPacket from the server.
      • getReceiveMaximum

        public java.lang.Long getReceiveMaximum()
        Returns the maximum number of in-flight QoS 1 and 2 messages the client is willing to handle. If omitted or null, then no limit is requested. See MQTT5 Receive Maximum
        Returns:
        The maximum number of in-flight QoS 1 and 2 messages the client is willing to handle.
      • getMaximumPacketSizeBytes

        public java.lang.Long getMaximumPacketSizeBytes()
        Returns the maximum packet size the client is willing to handle. If omitted or null, then no limit beyond the natural limits of MQTT packet size is requested. See MQTT5 Maximum Packet Size
        Returns:
        The maximum packet size the client is willing to handle
      • getWillDelayIntervalSeconds

        public java.lang.Long getWillDelayIntervalSeconds()
        Returns a time interval, in seconds, that the server should wait (for a session reconnection) before sending the will message associated with the connection's session. If omitted or null, the server will send the will when the associated session is destroyed. If the session is destroyed before a will delay interval has elapsed, then the will must be sent at the time of session destruction. See MQTT5 Will Delay Interval
        Returns:
        A time interval, in seconds, that the server should wait (for a session reconnection) before sending the will message associated with the connection's session.
      • getWill

        public PublishPacket getWill()
        Returns the definition of a message to be published when the connection's session is destroyed by the server or when the will delay interval has elapsed, whichever comes first. If null, then nothing will be sent. See MQTT5 Will
        Returns:
        The message to be published when the connection's session is destroyed by the server or when the will delay interval has elapsed, whichever comes first.
      • getUserProperties

        public java.util.List<UserProperty> getUserProperties()
        Returns a list of MQTT5 user properties included with the packet. See MQTT5 User Property
        Returns:
        List of MQTT5 user properties included with the packet.