Skip to content

Commit

Permalink
remove waitforconnection
Browse files Browse the repository at this point in the history
  • Loading branch information
haslinghuis committed Sep 24, 2024
1 parent a885768 commit 7cea321
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
1 change: 1 addition & 0 deletions src/js/data_storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const CONFIGURATOR = {

connectionValid: false,
connectionValidCliOnly: false,
bluetoothMode: false,
manualMode: false,
virtualMode: false,
virtualApiVersion: '0.0.1',
Expand Down
13 changes: 0 additions & 13 deletions src/js/protocols/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,6 @@ class WebsocketSerial extends EventTarget {
return new Uint8Array(buffer);
}

waitForConnection(socket) {
return new Promise((resolve) => {
const interval = setInterval(() => {
if (socket.connected) {
clearInterval(interval); // Stop checking
resolve(); // Resolve the promise
}
}, 100); // Check every 100ms, adjust as needed
});
}

async connect(path, options) {
this.address = path;
console.log(`${this.logHead} Connecting to ${this.address}`);
Expand All @@ -85,8 +74,6 @@ class WebsocketSerial extends EventTarget {
);
};

await this.waitForConnection(socket);

this.ws.onclose = function(e) {
console.log(`${socket.logHead} Connection closed: `, e);

Expand Down

0 comments on commit 7cea321

Please sign in to comment.