Skip to content

Commit

Permalink
okay, re-added the update poller
Browse files Browse the repository at this point in the history
  • Loading branch information
hoeken committed Dec 13, 2023
1 parent 93e62d0 commit 85baf39
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class YarrboardClient {
this.messageQueue = [];
this.messageTimeout = 2000;

this.updateInterval = 1000;

this.messageQueueDelayMax = 250;
this.messageQueueDelayMin = 10; //limit the client to 100 messages / second
this.messageQueueDelay = this.messageQueueDelayMin;
Expand Down Expand Up @@ -184,6 +186,19 @@ class YarrboardClient {
return this.send({ "cmd": "get_update" }, requireConfirmation);
}

startUpdatePoller(update_interval) {
this.updateInterval = update_interval;
this._updatePoller();
}

_updatePoller() {
if (this.isOpen()) {
this.log("updater");
this.getUpdate();
setTimeout(this._updatePoller.bind(this), this.updateInterval);
}
}

getStats(requireConfirmation = false) {
return this.send({ "cmd": "get_stats" }, requireConfirmation);
}
Expand Down

0 comments on commit 85baf39

Please sign in to comment.