lib/ably/realtime/channel.rb in ably-1.1.4.rc vs lib/ably/realtime/channel.rb in ably-1.1.4

- old
+ new

@@ -77,24 +77,23 @@ # Channel options configured for this channel, see {#initialize} for channel_options # @return [Hash] attr_reader :options + # Properties of a channel and its state + # @return [{Ably::Realtime::Channel::ChannelProperties}] + attr_reader :properties + # When a channel failure occurs this attribute contains the Ably Exception # @return [Ably::Models::ErrorInfo,Ably::Exceptions::BaseAblyException] attr_reader :error_reason # The Channel manager responsible for attaching, detaching and handling failures for this channel # @return [Ably::Realtime::Channel::ChannelManager] # @api private attr_reader :manager - # Serial number assigned to this channel when it was attached - # @return [Integer] - # @api private - attr_reader :attached_serial - # Initialize a new Channel object # # @param client [Ably::Rest::Client] # @param name [String] The name of the channel # @param channel_options [Hash] Channel options, currently reserved for Encryption options @@ -110,10 +109,11 @@ @state_machine = ChannelStateMachine.new(self) @state = STATE(state_machine.current_state) @manager = ChannelManager.new(self, client.connection) @push = PushChannel.new(self) + @properties = ChannelProperties.new(self) setup_event_handlers setup_presence end @@ -290,11 +290,11 @@ if options.delete(:until_attach) unless attached? error = Ably::Exceptions::InvalidRequest.new('option :until_attach is invalid as the channel is not attached' ) return Ably::Util::SafeDeferrable.new_and_fail_immediately(logger, error) end - options[:from_serial] = attached_serial + options[:from_serial] = properties.attach_serial end async_wrap(callback) do rest_channel.history(options.merge(async_blocking_operations: true)) end @@ -318,15 +318,10 @@ def clear_error_reason @error_reason = nil end # @api private - def set_attached_serial(serial) - @attached_serial = serial - end - - # @api private def update_options(channel_options) @options = channel_options.clone.freeze end # Used by {Ably::Modules::StateEmitter} to debug state changes @@ -370,5 +365,6 @@ end require 'ably/realtime/channel/channel_manager' require 'ably/realtime/channel/channel_state_machine' require 'ably/realtime/channel/push_channel' +require 'ably/realtime/channel/channel_properties'