If you are up for trying node.js, my ICU project does a lot of what you want.
https://www.ifm.net.nz/cookbooks/meraki-icu.html
Basically you need to call ProcessSnapshot(), but you can delete the timestamp parameter from everything so you get a snapshot "right now".
You would use something like SetTimeout() in the code to call ProcessSnapshot at regular time intervals (and you would use it in ProcessSnapshot() as well).
You would delete everything to do with MQTT,