Closed nibelungen closed 8 years ago
Are you sure the broker supports "retain" and "QoS 1" functions? Are you using different(unique) client IDs of publisher and subscriber?
I tested the "retain" function with the broker test.mosquitto.org:1883, and it worked. xmqttpub.php.txt xmqttsub.php.txt
Good luck!
Hi n-hirano,
the broker should support it - i´ve tested it with a message out of node-red. But for the point with the unique client ID im not sure - what does unique in this case mean? Isnt the retain message not bound to the topic rather than the client id? Maybe i was wrong there...
thanks!
I've heard/seen that some brokers don't support Retain function. (for example; RabbitMQ(v3.5.3), Mosca(v0.29.0))
Client ID is specified at third argument of construction of phpMQTT. (new phpMQTT($host, $port, $clientid);) I just suggest we shouldn't use same ID for Publisher and Subscriber at the same time. I'm not sure it does matter or not in this issue. But it seems some brokers handle client-ID strictly.
It seems test.mosquitto.org is down now. Ouch...
I´m uisng current version of mosquitto broker. My script only publish messages, no subscriptions so far. I will try another client id for the messages with retain option. Will give some feedback later.
regards
Okay... maybe it is my fault. If the message arrives in node red, debugging says the message is not retain. If i make a full deploy of flow mqtt make a reconnect and show me the message as retained message - strange but phpMQTT works without issue in this case! I close this 'issue' now as it isnt really an issue...
Thanks and sorry...
Hey,
first - thanks for your work. Is there any chance to get the ratain flag to work? Maybe i'am doing something wrong?!
$mqtt = new phpMQTT("[redacted]", [redacted], "[redacted]"); if ($mqtt->connect(true, NULL, "[redacted]", "[redacted]")) { $mqtt->publish("/ak/POWER/20","20",1,1); $mqtt->close(); }
QoS 1 works so far.
Thanks and best regards, andreas