Sha256: b74542cc448ac1ac857a51a760c2dabebef94487e7ac9360e1a2700122bb9c9c

Contents?: true

Size: 990 Bytes

Versions: 6

Compression:

Stored size: 990 Bytes

Contents

# frozen_string_literal: true

require "action_cable/remote_connections"

ActionCable::RemoteConnections::RemoteConnection.include(AnyCable::Rails::Connections::SerializableIdentification)

ActionCable::RemoteConnections::RemoteConnection.prepend(Module.new do
  # Rails <7.1 has no `reconnect` argument
  if ActionCable::RemoteConnections::RemoteConnection.instance_method(:disconnect).arity == 0
    def disconnect(reconnect: true)
      # Legacy Action Cable functionality if case we're not fully migrated yet
      super() unless AnyCable::Rails.enabled?
      ::AnyCable.broadcast_adapter.broadcast_command("disconnect", identifier: identifiers_json, reconnect: reconnect)
    end
  else
    def disconnect(reconnect: true)
      # Legacy Action Cable functionality if case we're not fully migrated yet
      super unless AnyCable::Rails.enabled?
      ::AnyCable.broadcast_adapter.broadcast_command("disconnect", identifier: identifiers_json, reconnect: reconnect)
    end
  end
end)

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
anycable-rails-core-1.5.3 lib/anycable/rails/action_cable_ext/remote_connections.rb
anycable-rails-core-1.5.2 lib/anycable/rails/action_cable_ext/remote_connections.rb
anycable-rails-core-1.5.1 lib/anycable/rails/action_cable_ext/remote_connections.rb
anycable-rails-core-1.5.0 lib/anycable/rails/action_cable_ext/remote_connections.rb
anycable-rails-core-1.5.0.rc.1 lib/anycable/rails/action_cable_ext/remote_connections.rb
anycable-rails-core-1.4.4 lib/anycable/rails/action_cable_ext/remote_connections.rb