This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
uphp:functions:mqtt_subscribe [2017/09/27 10:46] admin |
uphp:functions:mqtt_subscribe [2021/09/13 05:57] (current) |
||
---|---|---|---|
Line 8: | Line 8: | ||
<well size=" | <well size=" | ||
- | <span style=" | + | <span style=" |
<span style=" | <span style=" | ||
<span style=" | <span style=" | ||
Line 30: | Line 30: | ||
<code php> | <code php> | ||
<? | <? | ||
- | |||
// Use the # as a wildcard so any messages to /cluster/1/ or its sub channels will be received | // Use the # as a wildcard so any messages to /cluster/1/ or its sub channels will be received | ||
Line 36: | Line 35: | ||
?> | ?> | ||
</ | </ | ||
+ | |||
+ | ====Example Callback==== | ||
+ | Callbacks can use the '' | ||
+ | |||
+ | <code php> | ||
+ | <? | ||
+ | $f=fopen(" | ||
+ | $st=fgets($f); | ||
+ | $msg=fgets($f); | ||
+ | $response=""; | ||
+ | if (substr($msg, | ||
+ | $variable=substr($msg, | ||
+ | $response=$variable.":" | ||
+ | } | ||
+ | if (strpos($st, | ||
+ | if (strpos($st," | ||
+ | mqtt_publish("/ | ||
+ | } else { | ||
+ | if (strpos($st," | ||
+ | print(" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | ?> | ||
+ | </ | ||
+ | |||
+ | ====Note===== | ||
+ | On WattmonPRO & MINI the maximum packet size is 128 bytes. | ||
====See Also==== | ====See Also==== |