better web socket errors; log cleanup (#2145)
This commit is contained in:
parent
a05b524b84
commit
85b242a253
9 changed files with 24 additions and 17 deletions
|
|
@ -34,7 +34,6 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
surprise: function () {
|
||||
console.log(this.$refs.sponsor);
|
||||
const { top, height, left, width } = this.$refs.sponsor.getBoundingClientRect();
|
||||
const x = (left + width / 2) / window.innerWidth;
|
||||
const y = (top + height / 2) / window.innerHeight;
|
||||
|
|
|
|||
|
|
@ -158,7 +158,6 @@ export default {
|
|||
return this.$t("main.targetCharge.inactiveLabel");
|
||||
},
|
||||
defaultDate: function () {
|
||||
console.log(this.targetTimeHourSuggestion, "target");
|
||||
const target = new Date();
|
||||
target.setSeconds(0);
|
||||
target.setMinutes(0);
|
||||
|
|
|
|||
|
|
@ -103,10 +103,18 @@ export default {
|
|||
created: function () {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
this.compact = urlParams.get("compact");
|
||||
this.connect(); // websocket listener
|
||||
setTimeout(this.connect, 0);
|
||||
},
|
||||
methods: {
|
||||
connect: function () {
|
||||
const supportsWebSockets = "WebSocket" in window;
|
||||
if (!supportsWebSockets) {
|
||||
window.app.error({
|
||||
message: "Web sockets not supported. Please upgrade your browser.",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const loc = window.location;
|
||||
const protocol = loc.protocol == "https:" ? "wss:" : "ws:";
|
||||
const uri =
|
||||
|
|
@ -116,20 +124,21 @@ export default {
|
|||
(loc.port ? ":" + loc.port : "") +
|
||||
loc.pathname +
|
||||
"ws";
|
||||
const ws = new WebSocket(uri),
|
||||
self = this;
|
||||
ws.onerror = function () {
|
||||
const ws = new WebSocket(uri);
|
||||
ws.onerror = () => {
|
||||
ws.close();
|
||||
};
|
||||
ws.onclose = function () {
|
||||
window.setTimeout(self.connect, 1000);
|
||||
ws.onclose = () => {
|
||||
window.setTimeout(this.connect, 1000);
|
||||
};
|
||||
ws.onmessage = function (evt) {
|
||||
ws.onmessage = (evt) => {
|
||||
try {
|
||||
var msg = JSON.parse(evt.data);
|
||||
store.update(msg);
|
||||
} catch (e) {
|
||||
window.app.error(e, evt.data);
|
||||
} catch (error) {
|
||||
window.app.error({
|
||||
message: `Failed to parse web socket data: ${error.message} [${evt.data}]`,
|
||||
});
|
||||
}
|
||||
};
|
||||
},
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
4
dist/index.html
vendored
4
dist/index.html
vendored
|
|
@ -1,4 +1,4 @@
|
|||
<!DOCTYPE html><html lang="de"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="description" content="EV Charge Controller"><meta name="author" content="andig"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black"><link rel="apple-touch-icon" sizes="180x180" href="ico/apple-touch-icon.png?[[.Version]]"><link rel="icon" type="image/png" sizes="32x32" href="ico/favicon-32x32.png?[[.Version]]"><link rel="icon" type="image/png" sizes="16x16" href="ico/favicon-16x16.png?[[.Version]]"><link rel="manifest" href="ico/site.webmanifest"><link rel="mask-icon" href="ico/safari-pinned-tab.svg?[[.Version]]" color="#18191a"><link rel="shortcut icon" href="ico/favicon.ico?[[.Version]]"><meta name="apple-mobile-web-app-title" content="evcc"><meta name="application-name" content="evcc"><meta name="msapplication-TileColor" content="#18191a"><meta name="msapplication-config" content="ico/browserconfig.xml"><meta name="theme-color" content="#18191a"><title>evcc</title><link href="css/chunk-vendors.a7b690cd.css" rel="preload" as="style"><link href="css/index.17216026.css" rel="preload" as="style"><link href="js/chunk-vendors.e8d8381a.js" rel="preload" as="script"><link href="js/index.d3cf20b4.js" rel="preload" as="script"><link href="css/chunk-vendors.a7b690cd.css" rel="stylesheet"><link href="css/index.17216026.css" rel="stylesheet"></head><body><script>window.evcc = {
|
||||
<!DOCTYPE html><html lang="de"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="description" content="EV Charge Controller"><meta name="author" content="andig"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black"><link rel="apple-touch-icon" sizes="180x180" href="ico/apple-touch-icon.png?[[.Version]]"><link rel="icon" type="image/png" sizes="32x32" href="ico/favicon-32x32.png?[[.Version]]"><link rel="icon" type="image/png" sizes="16x16" href="ico/favicon-16x16.png?[[.Version]]"><link rel="manifest" href="ico/site.webmanifest"><link rel="mask-icon" href="ico/safari-pinned-tab.svg?[[.Version]]" color="#18191a"><link rel="shortcut icon" href="ico/favicon.ico?[[.Version]]"><meta name="apple-mobile-web-app-title" content="evcc"><meta name="application-name" content="evcc"><meta name="msapplication-TileColor" content="#18191a"><meta name="msapplication-config" content="ico/browserconfig.xml"><meta name="theme-color" content="#18191a"><title>evcc</title><link href="css/chunk-vendors.a7b690cd.css" rel="preload" as="style"><link href="css/index.22b76587.css" rel="preload" as="style"><link href="js/chunk-vendors.e8d8381a.js" rel="preload" as="script"><link href="js/index.2c7ee3ad.js" rel="preload" as="script"><link href="css/chunk-vendors.a7b690cd.css" rel="stylesheet"><link href="css/index.22b76587.css" rel="stylesheet"></head><body><script>window.evcc = {
|
||||
version: "[[.Version]]",
|
||||
configured: "[[.Configured]]",
|
||||
};</script><div id="app"></div><script src="js/chunk-vendors.e8d8381a.js"></script><script src="js/index.d3cf20b4.js"></script></body></html>
|
||||
};</script><div id="app"></div><script src="js/chunk-vendors.e8d8381a.js"></script><script src="js/index.2c7ee3ad.js"></script></body></html>
|
||||
2
dist/js/index.2c7ee3ad.js
vendored
Normal file
2
dist/js/index.2c7ee3ad.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
dist/js/index.2c7ee3ad.js.map
vendored
Normal file
1
dist/js/index.2c7ee3ad.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
2
dist/js/index.d3cf20b4.js
vendored
2
dist/js/index.d3cf20b4.js
vendored
File diff suppressed because one or more lines are too long
1
dist/js/index.d3cf20b4.js.map
vendored
1
dist/js/index.d3cf20b4.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue