signalk-polar-performance-plugin 0.0.42 → 0.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "signalk-polar-performance-plugin",
3
- "version": "0.0.42",
3
+ "version": "0.0.43",
4
4
  "description": "A plugin that calculates performance information based on a (CSV) polar diagram.",
5
5
  "main": "plugin/index.js",
6
6
  "scripts": {
package/public/index.html CHANGED
@@ -163,15 +163,24 @@ function connect () {
163
163
 
164
164
  ws.onclose = function() {
165
165
  console.log("WebSocket closed")
166
+ setTimeout(connect, 500)
166
167
  }
167
168
 
168
169
  ws.onerror = function(err) {
169
170
  console.log("WebSocket connection error: " + err.message + " - closing connection");
171
+ setTimeout(connect, 500)
170
172
  }
171
173
 
172
174
  }
173
175
  }
174
176
 
177
+ window.addEventListener('focus', function () {
178
+ if (ws.readyState == 0) {
179
+ console.log("Restarting websocket")
180
+ connect()
181
+ }
182
+ })
183
+
175
184
  function startListeners () {
176
185
  var paths = [{'path': 'environment.wind.angleTrueWaterDamped'}, {'path': 'performance.polarSpeed'}, {'path': 'performance.boatSpeedDamped'}]
177
186