Using MQTT within Scriptable for an iOS 14 Widget

I want to make a Scriptable Widget for iOS 14 that subscribes to an MQTT broker and displays that information. What are the capabilities of Scriptable to use a JS library - or can Scriptable include an MQTT library?

Scriptable can only do HTTP requests through the Request API. There is no underlying functionality for sockets so a 3rd party library won’t work.

Your best bet is to have a hosted service somewhere that subscribes to the MQTT topic and makes it available over https. Something like AWS IoT + S3 + API gateway would do the job.

io.adafruit.com has an MQTT broker that’s also available via a simple HTTP API. It’s free for a limited number of topics and requests per minute.

Another option would be to run Node-Red on your home network and use to create an HTTP-to-MQTT gateway.

Thank you - that might work. I might also go look for some packages that I might self-host for this purpose.

Using MQTT in Scriptable sounds really interesting for me. Have there been any changes?