Skip to content

Commit

Permalink
avoiding multiple reconnect requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbie1977 committed Feb 28, 2021
1 parent e7df4c8 commit 2a5b3a0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions components/VFBMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -1491,7 +1491,7 @@ class VFBMain extends React.Component {

GEPPETTO.on(GEPPETTO.Events.Websocket_disconnected, function () {
window.ga('vfb.send', 'event', 'disconnected', 'websocket-disconnect', (window.location.pathname + window.location.search));
if (GEPPETTO.MessageSocket.socketStatus != GEPPETTO.Resources.SocketStatus.OPEN) {
if (GEPPETTO.MessageSocket.socketStatus == GEPPETTO.Resources.SocketStatus.CLOSE) {
if (GEPPETTO.MessageSocket.attempts < 10) {
window.ga('vfb.send', 'event', 'reconnect-attempt:' + GEPPETTO.MessageSocket.attempts, 'websocket-disconnect', (window.location.pathname + window.location.search));
GEPPETTO.MessageSocket.reconnect();
Expand All @@ -1502,11 +1502,11 @@ class VFBMain extends React.Component {
}
} else {
setTimeout(() => {
if (GEPPETTO.MessageSocket.socketStatus != GEPPETTO.Resources.SocketStatus.OPEN) {
if (GEPPETTO.MessageSocket.socketStatus == GEPPETTO.Resources.SocketStatus.CLOSE) {
window.ga('vfb.send', 'event', 'reconnect-attempt:' + GEPPETTO.MessageSocket.attempts, 'websocket-disconnect', (window.location.pathname + window.location.search));
GEPPETTO.MessageSocket.reconnect();
}
}, 2000);
}, 3000);
}
});
}
Expand Down

0 comments on commit 2a5b3a0

Please sign in to comment.