Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Added realtime updates #2

Merged
merged 3 commits into from
Jul 13, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed one error in reconnect
  • Loading branch information
cesmec committed Jul 9, 2019
commit 09b8ebe7e2a088c89457e24656075772f47e3a02
2 changes: 2 additions & 0 deletions src/app/pages/betterrepl/betterrepl.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ export class BetterREPLComponent extends UpgradableComponent {
this.eventSource = new EventSource(`${this.configService["basePath"]}/events?authKey=${this.authKey}`);
this.eventSource.onerror = () => {
console.log("Lost connection. Trying to reconnect...");
this.eventsStarted = false;
setTimeout(() => this.login(this.lastPassword), 1000);
};
this.eventSource.addEventListener("instance", (e: MessageEvent) => {
Expand Down Expand Up @@ -215,6 +216,7 @@ export class BetterREPLComponent extends UpgradableComponent {
this.eventSource.addEventListener("close", () => {
this.eventSource.close();
this.eventSource = null;
this.eventsStarted = false;
});
this.eventsStarted = true;
}
Expand Down