Sha256: 5a828b50fe7255db463b4f2f7164ba142b052fa6d91ccf80fad66b69f54b27f8
Contents?: true
Size: 1.08 KB
Versions: 13
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true require "action_cable" ActionCable::Channel::Base.prepend(Module.new do def subscribe_to_channel super unless anycabled? && !@__anycable_subscribing__ end def handle_subscribe @__anycable_subscribing__ = true subscribe_to_channel ensure @__anycable_subscribing__ = false end def start_periodic_timers super unless anycabled? end def stop_periodic_timers super unless anycabled? end def stream_from(broadcasting, _callback = nil, **) return super unless anycabled? broadcasting = String(broadcasting) connection.anycable_socket.subscribe identifier, broadcasting end def stop_stream_from(broadcasting) return super unless anycabled? connection.anycable_socket.unsubscribe identifier, broadcasting end def stop_all_streams return super unless anycabled? connection.anycable_socket.unsubscribe_from_all identifier end private def anycabled? # Use instance variable check here for testing compatibility connection.instance_variable_defined?(:@anycable_socket) end end)
Version data entries
13 entries across 13 versions & 2 rubygems