don't crash if fail to connect to websockets

This commit is contained in:
nicolas.dorier 2017-12-17 20:28:18 +09:00
parent 582e1eb4f8
commit f0755260a6

View file

@ -208,10 +208,16 @@ if (supportsWebSockets) {
var path = srvModel.serverUrl + "/i/" + srvModel.invoiceId + "/status/ws";
path = path.replace("https://", "wss://");
path = path.replace("http://", "ws://");
var socket = new WebSocket(path);
socket.onmessage = function (e) {
fetchStatus();
};
try {
var socket = new WebSocket(path);
socket.onmessage = function (e) {
fetchStatus();
};
}
catch
{
console.error("Error while connecting to websocket for invoice notifictions");
}
}
var watcher = setInterval(function () {