Skip to content

Commit

Permalink
ensuring attempt counter is incremented on all failures
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbie1977 committed Apr 8, 2024
1 parent b0effd4 commit 0b19f7d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions geppetto-client/js/communication/MessageSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,18 @@ define(function (require) {
case 1000:
GEPPETTO.MessageSocket.socketStatus = GEPPETTO.Resources.SocketStatus.CLOSE;
GEPPETTO.CommandController.log(GEPPETTO.Resources.WEBSOCKET_CLOSED, true);
GEPPETTO.MessageSocket.attempts++;
break;
case 1002:
GEPPETTO.MessageSocket.socketStatus = GEPPETTO.Resources.SocketStatus.CLOSE;
GEPPETTO.CommandController.log(GEPPETTO.Resources.WEBSOCKET_CLOSED, true);
GEPPETTO.MessageSocket.attempts++;
break;
default:
if (GEPPETTO.MessageSocket.lostConnectionId === undefined) {
GEPPETTO.MessageSocket.lostConnectionId = GEPPETTO.MessageSocket.getClientID();
}
GEPPETTO.MessageSocket.attempts++;
GEPPETTO.MessageSocket.reconnect(e);
}
};
Expand Down Expand Up @@ -134,15 +137,18 @@ define(function (require) {
case 'ECONNREFUSED':
console.log("%c WebSocket Status - Open connection error ", 'background: #000; color: red');
GEPPETTO.CommandController.log(GEPPETTO.Resources.WEBSOCKET_CONNECTION_ERROR, true);
GEPPETTO.MessageSocket.attempts++;
break;
case undefined:
console.log("%c WebSocket Status - Open connection error ", 'background: #000; color: red');
GEPPETTO.CommandController.log(GEPPETTO.Resources.WEBSOCKET_RECONNECTION, true);
GEPPETTO.MessageSocket.attempts++;
break;
default:
console.log("%c WebSocket Status - Closed ", 'background: #000; color: red');
GEPPETTO.MessageSocket.socketStatus = GEPPETTO.Resources.SocketStatus.CLOSE;
GEPPETTO.ModalFactory.infoDialog(GEPPETTO.Resources.WEBSOCKET_CONNECTION_ERROR, message);
GEPPETTO.MessageSocket.attempts++;
break;
}
}
Expand Down

0 comments on commit 0b19f7d

Please sign in to comment.