Open
Description
Describe the bug
As soon as I connect to an MQTT broker, the event loop stops running and/or becomes very unpredictable.
To Reproduce
Steps to reproduce the behavior:
- Clone the nodegui-starter as described in the Quick Start Guide
npm install @nodegui/nodegui@latest --save
- Add a loop to update one of the labels every second
async function loop() {
while(true) {
const timestamp = Math.floor(+new Date() / 1000);
label.setText( `Timestamp: ${timestamp.toString()}` );
await new Promise(resolve => setTimeout(resolve, 1000));
}
}
loop();
npm start
- Everything works as expected. Woo!
- install mqtt module, connect to MQTT server
import * as mqtt from 'mqtt';
mqtt.connect('mqtt://localhost:1883');
- Add a button listener, just in case this is related to Promises don't resolve until a QT event is raised. #864
button.addEventListener('clicked',(checked)=>console.log("clicked"));
- The loop executes once, but then gets stuck. Even if I click the button.
Expected behavior
The label should continue to be updated every second, even with a MQTT client present.
Desktop (please complete the following information):
- OS: Windows
- NodeGUI version: 0.62.0
- OS Version: Windows 11
Additional Context
I've tried various other ways of pausing execution, including not using Promises or setTimeout, but this usually ends up freezing the QWindow altogether, resulting in a white, empty window.
Metadata
Metadata
Assignees
Labels
No labels