add proper error and disconnect handling
error handling shows you the error and offers the ability to reload; disconnect handling shows you that the page will reload in a few seconds. it uses exponential backoff with some random sprinkled into it to prevent overwhelming the server once people's clients decide to reconnect.
This commit is contained in:
parent
84abba3e0b
commit
0d831698e2
8 changed files with 150 additions and 20 deletions
|
@ -1,10 +1,10 @@
|
|||
// NOTE: The server never fulfills this request, it stalls forever.
|
||||
// Once the connection is closed, we try to connect with the server until we establish a successful
|
||||
// connection. Then we reload the page.
|
||||
await fetch("/dev/live-reload/stall").catch(async () => {
|
||||
await fetch("/auto-reload/stall").catch(async () => {
|
||||
while (true) {
|
||||
try {
|
||||
let response = await fetch("/dev/live-reload/back-up");
|
||||
let response = await fetch("/auto-reload/back-up");
|
||||
if (response.status == 200) {
|
||||
window.location.reload();
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue