Street testing fixes

This commit is contained in:
Robin Davies
2021-12-31 10:30:31 -05:00
parent d717a742b9
commit 96584fd4a7
17 changed files with 868 additions and 116 deletions
+18 -1
View File
@@ -164,7 +164,7 @@ class PiPedalSocket {
}
} catch (error) {
if (this.onError) {
this.onError("Invalid server response. " + error, error);
this.onError("Invalid server response. " + error, error as Error);
} else {
throw new PiPedalStateError("Invalid server response.");
}
@@ -189,6 +189,9 @@ class PiPedalSocket {
return;
}
this._reconnect();
}
_reconnect() {
this._discardReplyReservations();
this.retrying = true;
this.retryCount = 0;
@@ -199,6 +202,20 @@ class PiPedalSocket {
this.reconnect();
}
isBackground: boolean = false;
enterBackgroundState()
{
this.isBackground = true;
this.socket?.close();
}
exitBackgroundState()
{
this.isBackground = false;
this._reconnect();
}
reconnect() {
if (this.socket)