NeilFraser / JS-Interpreter

A sandboxed JavaScript interpreter in JavaScript.
Apache License 2.0
1.98k stars 353 forks source link

Function async with MQTT and blockly #212

Closed nonodev96 closed 3 years ago

nonodev96 commented 3 years ago

Hi, I'm trying to make a block with Blockly and MQTT that subscribes to a topic and receives the data, but I don't know how the interpreter would be done.

Sending to a topic is simple since you only send once and wait for it to respond correctly or fail, but I don't know how to do it so that it is all the time pending what is published in the topic.

cpcallen commented 3 years ago

This seems more like a question about MQTT or Blockly than about the JS Interpreter, but if you can explain more about why you are using JS Interpreter, what you want the code running in JS Interpreter to look like, and what MQTT calls should result from running the interpreted code we might be able to help you anyway.

nonodev96 commented 3 years ago

Hi, we wanted to manage the subscriptions of the MQTT topics through events, in the end we did it in a linear way with waits, in the end we did an infinite loop with waits that read the messages it receives from a topic.

We could not create an interpreter for MQTT events.

Personal project