Rasika Perera 7 years ago committed by Madhawa Perera
parent 0b4882e667
commit afe66f237a

@ -37,6 +37,9 @@
<i class="fw fw-statistics fw-stack-1x"></i>
</span> View Device Analytics
</a>
<div class="hide" id="websocker-onerror">
Realtime Analytics is not available. Failed to connect to the websocket. Please make sure; '<a style="color: white" href="$webSocketURL">$webSocketURL</a>' is available and re-try again.
</div>
<!-- /statistics -->
{{#zone "bottomJs"}}
{{js "js/moment.min.js"}}

@ -48,6 +48,15 @@ function connect(target) {
}
$("#time-mode").text("Real Time Mode");
};
ws.onerror = function (webSocketData) {
var websocketURL = webSocketData.currentTarget.url;
websocketURL = websocketURL.replace("wss://","https://");
var uriParts = websocketURL.split("/");
websocketURL = uriParts[0] + "//" + uriParts[2];
var errorMsg = $("#websocker-onerror").html();
errorMsg = errorMsg.replace(new RegExp('\\$webSocketURL', 'g'), websocketURL);
$("#div-chart").html("<div class='alert alert-danger'>" + errorMsg + "</div>");
};
}
}

@ -571,7 +571,11 @@ var webSocketOnAlertClose = function (e) {
};
var webSocketOnAlertError = function (e) {
noty({text: 'Something went wrong when trying to connect to <b>' + alertWebSocketURL + '<b/>', type: 'error'});
var wsURL = alertWebSocketURL;
wsURL = wsURL.replace("wss://","https://");
var uriParts = wsURL.split("/");
wsURL = uriParts[0] + "//" + uriParts[2];
noty({text: 'Something went wrong when trying to connect to <b>' + wsURL + '<b/>', type: 'error'});
};
var webSocketSpatialOnOpen = function () {
@ -598,7 +602,11 @@ var webSocketSpatialOnClose = function (e) {
};
var webSocketSpatialOnError = function (err) {
noty({text: 'Something went wrong when trying to connect to <b>' + webSocketURL + '<b/>', type: 'error'});
var wsURL = webSocketURL;
wsURL = wsURL.replace("wss://","https://");
var uriParts = wsURL.split("/");
wsURL = uriParts[0] + "//" + uriParts[2];
noty({text: 'Something went wrong when trying to connect to <b>' + wsURL + '<b/>', type: 'error'});
};

Loading…
Cancel
Save