mobility-toolbox-js 1.6.0-beta.3 → 1.6.0-beta.4

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.
@@ -80,6 +80,9 @@ class TralisAPI {
80
80
  /** @ignore */
81
81
  this.conn = new WebSocketConnector(wsUrl);
82
82
 
83
+ this.conn.isSUBAllow = !this.isUpdateBboxOnMoveEnd;
84
+ this.conn.isDELAllow = !this.isUpdateBboxOnMoveEnd;
85
+
83
86
  if (!this.isUpdateBboxOnMoveEnd) {
84
87
  this.conn.setProjection(options.projection || 'epsg:3857');
85
88
 
@@ -11,6 +11,9 @@ class WebSocketConnector {
11
11
  this.subscriptions = [];
12
12
  this.connect(url);
13
13
 
14
+ this.isSUBAllow = true;
15
+ this.isDELAllow = true;
16
+
14
17
  // keep websocket alive
15
18
  setInterval(() => {
16
19
  this.send('PING');
@@ -205,8 +208,10 @@ class WebSocketConnector {
205
208
  // if (!newSubscr.quiet) {
206
209
  this.send(`GET ${reqStr}`);
207
210
 
208
- // this.send(`SUB ${reqStr}`);
209
- // }
211
+ if (this.isSUBAllow) {
212
+ this.send(`SUB ${reqStr}`);
213
+ }
214
+
210
215
  this.subscribed[reqStr] = true;
211
216
  }
212
217
  }
@@ -240,7 +245,9 @@ class WebSocketConnector {
240
245
  this.subscribed[source] &&
241
246
  !this.subscriptions.find((s) => s.params.channel === source)
242
247
  ) {
243
- // this.send(`DEL ${source}`);
248
+ if (this.isDELAllow) {
249
+ this.send(`DEL ${source}`);
250
+ }
244
251
  this.subscribed[source] = false;
245
252
  }
246
253
  }