You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, thanks for your making this package. I am playing around with MQTT for the first time today. I am trying to use shiny for displaying live sensor data.
This is the example you gave on the frontpage:
library(mqtt)
sensor <- function(id, topic, payload, qos, retain, con) {
if (topic == "bbc/subtitles/bbc_two_england/raw") {
cat(crayon::cyan(topic), crayon::blue(readBin(payload, "character")), "\n", sep=" ")
}
}
# NOTE: Use a unique name vs `hrbrunique`
mqtt_broker("hrbrnique", "test.mosquitto.org", 1883L) %>%
mqtt_silence(c("error", "log")) %>%
mqtt_subscribe(
"bbc/subtitles/bbc_one_london/raw",
function(id, topic, payload, qos, retain, con) { # regular anonymous function
if (topic == "bbc/subtitles/bbc_one_london/raw")
cat(crayon::yellow(topic), crayon::green(readBin(payload, "character")), "\n", sep=" ")
}) %>%
mqtt_subscribe("bbc/subtitles/bbc_news24/raw", ~{ # tilde shortcut function (passing in named, pre-known params)
if (topic == "bbc/subtitles/bbc_news24/raw")
cat(crayon::yellow(topic), crayon::red(readBin(payload, "character")), "\n", sep=" ")
}) %>%
mqtt_subscribe("bbc/subtitles/bbc_two_england/raw", sensor) %>% # named function
mqtt_run() -> res
I can't figure out how to stop it from executing (for me it is printing out the subtitles without an end). I set the 'times' argument in mqtt_run but it does not seem to have any effect.
I am not really interested in printing the results to the console but to save them in a vector to make some quick analysis.
The text was updated successfully, but these errors were encountered:
But be careful this timeout is an interval in minutes contrary to what you can read in documentation.
Also it is not really usable because the process is not really close, you only don't have new data coming after the timeout.
Hi, thanks for your making this package. I am playing around with MQTT for the first time today. I am trying to use shiny for displaying live sensor data.
This is the example you gave on the frontpage:
I can't figure out how to stop it from executing (for me it is printing out the subtitles without an end). I set the 'times' argument in mqtt_run but it does not seem to have any effect.
I am not really interested in printing the results to the console but to save them in a vector to make some quick analysis.
The text was updated successfully, but these errors were encountered: