lib/ably/models/protocol_message.rb in ably-0.8.15 vs lib/ably/models/protocol_message.rb in ably-1.0.0

- old
+ new

@@ -6,18 +6,20 @@ # See the {http://docs.ably.io/client-lib-development-guide/protocol/ Ably client library developer documentation} # for further details on the members of a ProtocolMessage # # @!attribute [r] action # @return [ACTION] Protocol Message action {Ably::Modules::Enum} from list of {ACTION}. Returns nil if action is unsupported by protocol + # @!attribute [r] auth + # @return [Ably::Models::AuthDetails] Authentication details used to perform authentication upgrades over an existing transport # @!attribute [r] count # @return [Integer] The count field is used for ACK and NACK actions. See {http://docs.ably.io/client-lib-development-guide/protocol/#message-acknowledgement message acknowledgement protocol} # @!attribute [r] error # @return [ErrorInfo] Contains error information # @!attribute [r] channel # @return [String] Channel name for messages # @!attribute [r] channel_serial - # @return [String] Contains a serial number for a message on the current channelÆ’ + # @return [String] Contains a serial number for a message on the current channel # @!attribute [r] connection_id # @return [String] Contains a string public identifier for the connection # @!attribute [r] connection_key # @return [String] Contains a string private connection key used to recover this connection # @!attribute [r] connection_serial @@ -60,17 +62,18 @@ attached: 11, detach: 12, detached: 13, presence: 14, message: 15, - sync: 16 + sync: 16, + auth: 17 ) # Indicates this protocol message action will generate an ACK response such as :message or :presence # @api private def self.ack_required?(for_action) - [ACTION.Presence, ACTION.Message].include?(ACTION(for_action)) + ACTION(for_action).match_any?(ACTION.Presence, ACTION.Message) end # {ProtocolMessage} initializer # # @param hash_object [Hash] object with the underlying protocol message data @@ -191,11 +194,25 @@ # @api private def has_presence_flag? flags & 1 == 1 end + # @api private + def has_backlog_flag? + flags & 2 == 2 + end + + # @api private + def has_channel_resumed_flag? + flags & 4 == 4 + end + def connection_details @connection_details ||= Ably::Models::ConnectionDetails(attributes[:connection_details]) + end + + def auth + @auth ||= Ably::Models::AuthDetails(attributes[:auth]) end # Indicates this protocol message will generate an ACK response when sent # Examples of protocol messages required ACK include :message and :presence # @api private