Improve disconnected message in public mode

This commit is contained in:
Pavel Djundik 2019-11-20 20:09:21 +02:00
parent f00dfc7524
commit d0444d7d7f
2 changed files with 16 additions and 1 deletions

View File

@ -11,7 +11,7 @@ socket.on("reconnecting", function(attempt) {
});
socket.on("connecting", function() {
store.commit("currentUserVisibleError", `Connecting…`);
store.commit("currentUserVisibleError", "Connecting…");
updateLoadingMessage();
});
@ -29,6 +29,16 @@ function handleDisconnect(data) {
const message = data.message || data;
store.commit("isConnected", false);
if (!socket.io.reconnection()) {
store.commit(
"currentUserVisibleError",
`Disconnected from the server (${message}), The Lounge does not reconnect in public mode.`
);
updateLoadingMessage();
return;
}
store.commit("currentUserVisibleError", `Waiting to reconnect… (${message})`);
updateLoadingMessage();

View File

@ -9,4 +9,9 @@ const socket = io({
reconnection: !document.body.classList.contains("public"),
});
// Ease debugging socket during development
if (process.env.NODE_ENV === "development") {
window.socket = socket;
}
export default socket;