//this is called when messages are sent 1 by 1 public void send(HikePacket packet, int qos) { if (!isConnected()) { /* only care about failures for messages we care about. */ if (qos > 0) { try { MqttDBUtils.addSentMessage(packet); } catch (Exception e) { } } this.connect(); return; } PublishCB pbCB = null; if (qos > 0) { pbCB = new PublishCB(packet, this, qos, false); } mqttConnection.publish(this.topic + HikeConstants.PUBLISH_TOPIC, packet.Message, (QoS)qos == 0 ? QoS.AT_MOST_ONCE : QoS.AT_LEAST_ONCE, pbCB); }