aboutsummaryrefslogtreecommitdiff
path: root/src/client/DocServer.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/DocServer.ts')
-rw-r--r--src/client/DocServer.ts20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/client/DocServer.ts b/src/client/DocServer.ts
index ed7fbd7ba..1723312cf 100644
--- a/src/client/DocServer.ts
+++ b/src/client/DocServer.ts
@@ -64,6 +64,22 @@ export namespace DocServer {
}
}
+ function alertUser(connectionTerminationReason: string) {
+ switch (connectionTerminationReason) {
+ case "crash":
+ alert("Dash has temporarily crashed. Administrators have been notified and the server is restarting itself. Please refresh your page in a few seconds, and expect to reconnect after about 30 seconds.");
+ break;
+ case "temporary":
+ alert("An administrator has chosen to restart the server. Please refresh your page in a few seconds, and expect to reconnect after about 30 seconds.");
+ break;
+ case "exit":
+ alert("An administrator has chosen to kill the server. Do not expect to reconnect until administrators start the server.");
+ break;
+ default:
+ console.log(`Received an unknown ConnectionTerminated message: ${connectionTerminationReason}`);
+ }
+ }
+
export function init(protocol: string, hostname: string, port: number, identifier: string) {
_cache = {};
GUID = identifier;
@@ -82,9 +98,7 @@ export namespace DocServer {
Utils.AddServerHandler(_socket, MessageStore.UpdateField, respondToUpdate);
Utils.AddServerHandler(_socket, MessageStore.DeleteField, respondToDelete);
Utils.AddServerHandler(_socket, MessageStore.DeleteFields, respondToDelete);
- Utils.AddServerHandler(_socket, MessageStore.ConnectionTerminated, () => {
- alert("Your connection to the server has been terminated.");
- });
+ Utils.AddServerHandler(_socket, MessageStore.ConnectionTerminated, alertUser);
}
function errorFunc(): never {