aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/app/javascript/action_cable/connection.js
diff options
context:
space:
mode:
authorMick Staugaard <mick@staugaard.com>2018-10-11 13:47:16 -0700
committerMick Staugaard <mick@staugaard.com>2018-12-05 10:40:29 -0800
commit58dbc1c2ed0e372d9cae4c9e3baebb679a726dc3 (patch)
tree9cfd085ce218a95879df56e8008d54978026e134 /actioncable/app/javascript/action_cable/connection.js
parentb802e08273f899d5f3b199f7c6a4f5d514c1b0e1 (diff)
downloadrails-58dbc1c2ed0e372d9cae4c9e3baebb679a726dc3.tar.gz
rails-58dbc1c2ed0e372d9cae4c9e3baebb679a726dc3.tar.bz2
rails-58dbc1c2ed0e372d9cae4c9e3baebb679a726dc3.zip
Stop trying to reconnect on unauthorized cable connections
Diffstat (limited to 'actioncable/app/javascript/action_cable/connection.js')
-rw-r--r--actioncable/app/javascript/action_cable/connection.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/actioncable/app/javascript/action_cable/connection.js b/actioncable/app/javascript/action_cable/connection.js
index 8aa4fe1266..b2910cb2a6 100644
--- a/actioncable/app/javascript/action_cable/connection.js
+++ b/actioncable/app/javascript/action_cable/connection.js
@@ -117,11 +117,14 @@ Connection.reopenDelay = 500
Connection.prototype.events = {
message(event) {
if (!this.isProtocolSupported()) { return }
- const {identifier, message, type} = JSON.parse(event.data)
+ const {identifier, message, reason, reconnect, type} = JSON.parse(event.data)
switch (type) {
case message_types.welcome:
this.monitor.recordConnect()
return this.subscriptions.reload()
+ case message_types.disconnect:
+ logger.log(`Disconnecting. Reason: ${reason}`)
+ return this.close({allowReconnect: reconnect})
case message_types.ping:
return this.monitor.recordPing()
case message_types.confirmation: