Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reconnect option not forwarded in ActionCable::RemoteConnections::RemoteConnection#disconnect #195

Closed
martin-kufner opened this issue Mar 7, 2024 · 2 comments

Comments

@martin-kufner
Copy link

martin-kufner commented Mar 7, 2024

Tell us about your environment

  • Development Environment
  • Anycable installed but not enabled

Ruby version: 3.2

Rails version: 7.1.3

anycable gem version: 1.4.3

anycable-rails gem version: 1.4.3

What did you do?

Disconnecting user with no reconnect
ActionCable.server.remote_connections.where(identity: User.find(...)).disconnect(reconnect: false)

What did you expect to happen?

reconnect is transmitted false

[ActionCable] Broadcasting to action_cable/. Z2lkOi8vcWIzL1BsYXllci8xODJhZTQzYy1jOGEyLTRkZWEtODk3My03YzBlNzdjOWNiNDMvYzI1ODA1NDgtMmMxYi00YWQ2LTkxM2MtM2QzYjkyMjhhOGY3:
{
     :type => "disconnect",
:reconnect => false
}

What actually happened?

reconnect is transmitted true

[ActionCable] Broadcasting to action_cable/Z2lkOi8vcWIzL1BsYXllci8xODJhZTQzYy1jOGEyLTRkZWEtODk3My03YzBlNzdjOWNiNDMvYzI1ODA1NDgtMmMxYi00YWQ2LTkxM2MtM2QzYjkyMjhhOGY3:
{
     :type => "disconnect",
:reconnect => true
}

Fix

anycable/rails/action_cable_ext/remote_connections.rb:10 in disconnect
IS super() unless AnyCable::Rails.enabled? - super is called w/o arguments
SHOULD BE super unless AnyCable::Rails.enabled? - without brackets, so super is called w/ arguments

@martin-kufner
Copy link
Author

This does not affect when AnyCable::Rails is enabled.

@palkan palkan closed this as completed in f7351e8 Mar 8, 2024
@palkan
Copy link
Member

palkan commented Mar 8, 2024

Thanks for reporting! Fixed and will be released soon.

without brackets, so super is called w/ arguments

The feature (reconnect: ... support) has been added only in Rails 7.1, so we should still super() for older version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants