@rails/actioncable 7.1.3 → 7.2.0-beta1

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.
@@ -43,12 +43,11 @@
43
43
  isRunning() {
44
44
  return this.startedAt && !this.stoppedAt;
45
45
  }
46
- recordPing() {
46
+ recordMessage() {
47
47
  this.pingedAt = now();
48
48
  }
49
49
  recordConnect() {
50
50
  this.reconnectAttempts = 0;
51
- this.recordPing();
52
51
  delete this.disconnectedAt;
53
52
  logger.log("ConnectionMonitor recorded connect");
54
53
  }
@@ -236,6 +235,7 @@
236
235
  return;
237
236
  }
238
237
  const {identifier: identifier, message: message, reason: reason, reconnect: reconnect, type: type} = JSON.parse(event.data);
238
+ this.monitor.recordMessage();
239
239
  switch (type) {
240
240
  case message_types.welcome:
241
241
  if (this.triedToReconnect()) {
@@ -251,7 +251,7 @@
251
251
  });
252
252
 
253
253
  case message_types.ping:
254
- return this.monitor.recordPing();
254
+ return null;
255
255
 
256
256
  case message_types.confirmation:
257
257
  this.subscriptions.confirmSubscription(identifier);
@@ -42,12 +42,11 @@ class ConnectionMonitor {
42
42
  isRunning() {
43
43
  return this.startedAt && !this.stoppedAt;
44
44
  }
45
- recordPing() {
45
+ recordMessage() {
46
46
  this.pingedAt = now();
47
47
  }
48
48
  recordConnect() {
49
49
  this.reconnectAttempts = 0;
50
- this.recordPing();
51
50
  delete this.disconnectedAt;
52
51
  logger.log("ConnectionMonitor recorded connect");
53
52
  }
@@ -244,6 +243,7 @@ Connection.prototype.events = {
244
243
  return;
245
244
  }
246
245
  const {identifier: identifier, message: message, reason: reason, reconnect: reconnect, type: type} = JSON.parse(event.data);
246
+ this.monitor.recordMessage();
247
247
  switch (type) {
248
248
  case message_types.welcome:
249
249
  if (this.triedToReconnect()) {
@@ -259,7 +259,7 @@ Connection.prototype.events = {
259
259
  });
260
260
 
261
261
  case message_types.ping:
262
- return this.monitor.recordPing();
262
+ return null;
263
263
 
264
264
  case message_types.confirmation:
265
265
  this.subscriptions.confirmSubscription(identifier);
@@ -43,12 +43,11 @@
43
43
  isRunning() {
44
44
  return this.startedAt && !this.stoppedAt;
45
45
  }
46
- recordPing() {
46
+ recordMessage() {
47
47
  this.pingedAt = now();
48
48
  }
49
49
  recordConnect() {
50
50
  this.reconnectAttempts = 0;
51
- this.recordPing();
52
51
  delete this.disconnectedAt;
53
52
  logger.log("ConnectionMonitor recorded connect");
54
53
  }
@@ -236,6 +235,7 @@
236
235
  return;
237
236
  }
238
237
  const {identifier: identifier, message: message, reason: reason, reconnect: reconnect, type: type} = JSON.parse(event.data);
238
+ this.monitor.recordMessage();
239
239
  switch (type) {
240
240
  case message_types.welcome:
241
241
  if (this.triedToReconnect()) {
@@ -251,7 +251,7 @@
251
251
  });
252
252
 
253
253
  case message_types.ping:
254
- return this.monitor.recordPing();
254
+ return null;
255
255
 
256
256
  case message_types.confirmation:
257
257
  this.subscriptions.confirmSubscription(identifier);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rails/actioncable",
3
- "version": "7.1.3",
3
+ "version": "7.2.0-beta1",
4
4
  "description": "WebSocket framework for Ruby on Rails.",
5
5
  "module": "app/assets/javascripts/actioncable.esm.js",
6
6
  "main": "app/assets/javascripts/actioncable.js",
@@ -24,11 +24,11 @@
24
24
  },
25
25
  "homepage": "https://rubyonrails.org/",
26
26
  "devDependencies": {
27
- "@rollup/plugin-node-resolve": "^11.0.1",
28
27
  "@rollup/plugin-commonjs": "^19.0.1",
28
+ "@rollup/plugin-node-resolve": "^11.0.1",
29
29
  "eslint": "^4.3.0",
30
30
  "eslint-plugin-import": "^2.7.0",
31
- "karma": "^3.1.1",
31
+ "karma": "^6.4.2",
32
32
  "karma-chrome-launcher": "^2.2.0",
33
33
  "karma-qunit": "^2.1.0",
34
34
  "karma-sauce-launcher": "^1.2.0",
package/src/connection.js CHANGED
@@ -128,6 +128,7 @@ Connection.prototype.events = {
128
128
  message(event) {
129
129
  if (!this.isProtocolSupported()) { return }
130
130
  const {identifier, message, reason, reconnect, type} = JSON.parse(event.data)
131
+ this.monitor.recordMessage()
131
132
  switch (type) {
132
133
  case message_types.welcome:
133
134
  if (this.triedToReconnect()) {
@@ -139,7 +140,7 @@ Connection.prototype.events = {
139
140
  logger.log(`Disconnecting. Reason: ${reason}`)
140
141
  return this.close({allowReconnect: reconnect})
141
142
  case message_types.ping:
142
- return this.monitor.recordPing()
143
+ return null
143
144
  case message_types.confirmation:
144
145
  this.subscriptions.confirmSubscription(identifier)
145
146
  if (this.reconnectAttempted) {
@@ -37,13 +37,12 @@ class ConnectionMonitor {
37
37
  return this.startedAt && !this.stoppedAt
38
38
  }
39
39
 
40
- recordPing() {
40
+ recordMessage() {
41
41
  this.pingedAt = now()
42
42
  }
43
43
 
44
44
  recordConnect() {
45
45
  this.reconnectAttempts = 0
46
- this.recordPing()
47
46
  delete this.disconnectedAt
48
47
  logger.log("ConnectionMonitor recorded connect")
49
48
  }