Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #424 from sandeep-deriv/sandeep/bot-1532/fix-infin…
Browse files Browse the repository at this point in the history
…ite-loading

sandeep/bot-1532/fix infinite loading
  • Loading branch information
rupato-deriv authored Mar 20, 2024
2 parents cd33435 + d1be334 commit d2ae19a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/api-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class APIBase {

constructor() {
this.init();
this.initEventListeners();
}

init() {
Expand All @@ -41,6 +40,7 @@ class APIBase {
this.api.onOpen().subscribe(() => {
// eslint-disable-next-line no-console
console.log('Connection has been established!');
this.initEventListeners();
});
} catch (error) {
globalObserver.emit('Error', error);
Expand Down Expand Up @@ -142,7 +142,7 @@ class APIBase {
// eslint-disable-next-line no-console
console.log('connection state: ', this.api.connection.readyState);

if (this.api.connection.readyState !== 1) {
if (![0, 1].includes(this.api.connection.readyState)) {
// eslint-disable-next-line no-console
console.log('Info: Connection to the server was closed, trying to reconnect.');
this.init();
Expand Down

0 comments on commit d2ae19a

Please sign in to comment.