add waiting on websockets

This commit is contained in:
Sem van der Hoeven
2023-05-30 10:29:27 +02:00
parent 3f3ee06925
commit 338ed03004

View File

@@ -11,6 +11,8 @@ app.use(express.json());
var ws = new WebSocket("ws://10.100.0.40:9001/");
var api_connected = false;
console.log("connecting to API...");
while (ws.readyState != 1) { }
ws.on("open", function open() {
console.log("connected with websockets to API!");