diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.realtime.analytics-view/analytics-view.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.realtime.analytics-view/analytics-view.hbs index 6911c698fc8..a1159a5643d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.realtime.analytics-view/analytics-view.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.realtime.analytics-view/analytics-view.hbs @@ -37,6 +37,9 @@ View Device Analytics +
+ Realtime Analytics is not available. Failed to connect to the websocket. Please make sure; '$webSocketURL' is available and re-try again. +
{{#zone "bottomJs"}} {{js "js/moment.min.js"}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.realtime.analytics-view/public/js/device-stats.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.realtime.analytics-view/public/js/device-stats.js index be1f1e7c0c5..e84224d15aa 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.realtime.analytics-view/public/js/device-stats.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.default.device.type.realtime.analytics-view/public/js/device-stats.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("
" + errorMsg + "
"); + }; } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/websocket.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/websocket.js index fbecf66217f..027de4459f2 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/websocket.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/websocket.js @@ -571,7 +571,11 @@ var webSocketOnAlertClose = function (e) { }; var webSocketOnAlertError = function (e) { - noty({text: 'Something went wrong when trying to connect to ' + alertWebSocketURL + '', 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 ' + wsURL + '', 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 ' + webSocketURL + '', 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 ' + wsURL + '', type: 'error'}); };