diff options
author | Mick Staugaard <mick@staugaard.com> | 2018-10-11 13:47:16 -0700 |
---|---|---|
committer | Mick Staugaard <mick@staugaard.com> | 2018-12-05 10:40:29 -0800 |
commit | 58dbc1c2ed0e372d9cae4c9e3baebb679a726dc3 (patch) | |
tree | 9cfd085ce218a95879df56e8008d54978026e134 /actioncable/app/javascript | |
parent | b802e08273f899d5f3b199f7c6a4f5d514c1b0e1 (diff) | |
download | rails-58dbc1c2ed0e372d9cae4c9e3baebb679a726dc3.tar.gz rails-58dbc1c2ed0e372d9cae4c9e3baebb679a726dc3.tar.bz2 rails-58dbc1c2ed0e372d9cae4c9e3baebb679a726dc3.zip |
Stop trying to reconnect on unauthorized cable connections
Diffstat (limited to 'actioncable/app/javascript')
-rw-r--r-- | actioncable/app/javascript/action_cable/connection.js | 5 |
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: |