statki/public/assets/js/socket-err-handler.js

72 lines
1.8 KiB
JavaScript
Raw Normal View History

// Handling connection errors
socket.on("reconnecting", (number) => {
Toastify({
2024-03-27 15:51:33 +01:00
text: `${window.locale["Reconnecting"]} ${number}`,
duration: 5000,
newWindow: true,
gravity: "bottom",
position: "right",
stopOnFocus: true,
className: "bshipstoast",
}).showToast();
});
socket.on("reconnect", () => {
Toastify({
2024-03-27 15:51:33 +01:00
text: window.locale["Reconnected"],
duration: 5000,
newWindow: true,
gravity: "bottom",
position: "right",
stopOnFocus: true,
className: "bshipstoast",
}).showToast();
});
socket.on("reconnect_error", () => {
Toastify({
2024-03-27 15:51:33 +01:00
text: window.locale["Reconnection error occured"],
duration: 5000,
newWindow: true,
gravity: "bottom",
position: "right",
stopOnFocus: true,
className: "bshipstoast",
}).showToast();
});
socket.on("reconnect_failed", () => {
Toastify({
2024-03-27 15:51:33 +01:00
text: window.locale["Reconnection failed"],
duration: 5000,
newWindow: true,
gravity: "bottom",
position: "right",
stopOnFocus: true,
className: "bshipstoast",
}).showToast();
});
socket.on("disconnect", () => {
Toastify({
2024-03-27 15:51:33 +01:00
text: `${window.locale["Disconnected"]}\n${window.locale["Try to refresh the page if this error reoccurs"]}`,
duration: 5000,
newWindow: true,
gravity: "bottom",
position: "right",
stopOnFocus: true,
className: "bshipstoast",
}).showToast();
});
socket.on("error", () => {
Toastify({
2024-03-27 15:51:33 +01:00
text: window.locale["Connection error"],
duration: 5000,
newWindow: true,
gravity: "bottom",
position: "right",
stopOnFocus: true,
className: "bshipstoast",
}).showToast();
});