/** * Set Packet Identifier * * @param int $msgid */ public function setMsgID($msgid) { $this->header->setMsgID($msgid); }
/** * Set Packet Identifier * * @param int $msgid * @throws Exception */ public function setMsgID($msgid) { /* A PUBLISH Packet MUST NOT contain a Packet Identifier if its QoS value is set to 0 [MQTT-2.3.1-5]. */ if ($this->qos) { parent::setMsgID($msgid); } else { if ($msgid) { throw new Exception('MsgID MUST NOT be set if QoS is set to 0.'); } } }