Class: Ably::Models::ConnectionDetails
- Inherits:
-
Object
- Object
- Ably::Models::ConnectionDetails
- Includes:
- Ably::Modules::ModelCommon
- Defined in:
- lib/submodules/ably-ruby/lib/ably/models/connection_details.rb
Overview
ConnectionDetails are optionally passed to the client library in the CONNECTED
ProtocolMessage#connectionDetails attribute to inform the client about any constraints it should adhere to and provide additional metadata about the connection. For example, if a request is made to publish a message that exceeds the maxMessageSize
, the client library can reject the message immediately, without communicating with the Ably service
Constant Summary collapse
- MAX_MESSAGE_SIZE =
Max message size
65536
- MAX_FRAME_SIZE =
Max frame size
524288
Instance Attribute Summary collapse
-
#attributes ⇒ Hash
readonly
Access the token details Hash object ruby'fied to use symbolized keys.
Attributes included from Ably::Modules::ModelCommon
Instance Method Summary collapse
- #has_client_id? ⇒ Boolean
-
#initialize(attributes = {}) ⇒ ConnectionDetails
constructor
A new instance of ConnectionDetails.
Methods included from Ably::Modules::ModelCommon
#==, #[], #as_json, included, #to_json, #to_s
Methods included from Ably::Modules::MessagePack
Constructor Details
#initialize(attributes = {}) ⇒ ConnectionDetails
Returns a new instance of ConnectionDetails.
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/submodules/ably-ruby/lib/ably/models/connection_details.rb', line 40 def initialize(attributes = {}) @hash_object = IdiomaticRubyWrapper(attributes.clone) [:connection_state_ttl, :max_idle_interval].each do |duration_field| if self.attributes[duration_field] self.attributes[duration_field] = (self.attributes[duration_field].to_f / 1000).round end end self.attributes[:max_message_size] ||= MAX_MESSAGE_SIZE self.attributes[:max_frame_size] ||= MAX_FRAME_SIZE self.attributes.freeze end |
Instance Attribute Details
#attributes ⇒ Hash (readonly)
Returns Access the token details Hash object ruby'fied to use symbolized keys.
64 65 66 |
# File 'lib/submodules/ably-ruby/lib/ably/models/connection_details.rb', line 64 def attributes @hash_object end |
Instance Method Details
#has_client_id? ⇒ Boolean
58 59 60 |
# File 'lib/submodules/ably-ruby/lib/ably/models/connection_details.rb', line 58 def has_client_id? attributes.has_key?(:client_id) end |