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
Contains any constraints a client should adhere to and provides additional metadata about a Realtime::Connection, such as if a request to Realtime::Client#publish a message that exceeds the maximum message size should be rejected immediately without communicating with Ably.
Constant Summary collapse
- MAX_MESSAGE_SIZE =
Max message size
65536
- MAX_FRAME_SIZE =
Max frame size
524288
Instance Attribute Summary
Attributes included from Ably::Modules::ModelCommon
Instance Method Summary collapse
-
#attributes ⇒ Hash
Access the token details Hash object ruby’fied to use symbolized keys.
-
#client_id ⇒ String
Contains the client ID assigned to the token.
-
#connection_key ⇒ String
The connection secret key string that is used to resume a connection and its state.
-
#connection_state_ttl ⇒ Integer
The duration that Ably will persist the connection state for when a Realtime client is abruptly disconnected.
- #has_client_id? ⇒ Boolean
-
#initialize(attributes = {}) ⇒ ConnectionDetails
constructor
A new instance of ConnectionDetails.
-
#max_frame_size ⇒ Integer
Overrides the default maxFrameSize.
-
#max_idle_interval ⇒ Integer
The maximum length of time in milliseconds that the server will allow no activity to occur in the server to client direction.
-
#max_inbound_rate ⇒ Integer
The maximum allowable number of requests per second from a client or Ably.
-
#max_message_size ⇒ Integer
The maximum message size is an attribute of an Ably account and enforced by Ably servers.
-
#server_id ⇒ String
A unique identifier for the front-end server that the client has connected to.
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.
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/submodules/ably-ruby/lib/ably/models/connection_details.rb', line 39 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 Method Details
#attributes ⇒ Hash
Returns Access the token details Hash object ruby’fied to use symbolized keys.
145 146 147 |
# File 'lib/submodules/ably-ruby/lib/ably/models/connection_details.rb', line 145 def attributes @hash_object end |
#client_id ⇒ String
Contains the client ID assigned to the token. If clientId is null or omitted, then the client is prohibited from assuming a clientId in any operations, however if clientId is a wildcard string *, then the client is permitted to assume any clientId. Any other string value for clientId implies that the clientId is both enforced and assumed for all operations from this client.
60 61 62 |
# File 'lib/submodules/ably-ruby/lib/ably/models/connection_details.rb', line 60 def client_id attributes[:client_id] end |
#connection_key ⇒ String
The connection secret key string that is used to resume a connection and its state.
70 71 72 |
# File 'lib/submodules/ably-ruby/lib/ably/models/connection_details.rb', line 70 def connection_key attributes[:connection_key] end |
#connection_state_ttl ⇒ Integer
The duration that Ably will persist the connection state for when a Realtime client is abruptly disconnected.
80 81 82 |
# File 'lib/submodules/ably-ruby/lib/ably/models/connection_details.rb', line 80 def connection_state_ttl attributes[:connection_state_ttl] end |
#has_client_id? ⇒ Boolean
139 140 141 |
# File 'lib/submodules/ably-ruby/lib/ably/models/connection_details.rb', line 139 def has_client_id? attributes.has_key?(:client_id) end |
#max_frame_size ⇒ Integer
Overrides the default maxFrameSize.
90 91 92 |
# File 'lib/submodules/ably-ruby/lib/ably/models/connection_details.rb', line 90 def max_frame_size attributes[:max_frame_size] end |
#max_idle_interval ⇒ Integer
The maximum length of time in milliseconds that the server will allow no activity to occur in the server to client direction. After such a period of inactivity, the server will send a HEARTBEAT or transport-level ping to the client. If the value is 0, the server will allow arbitrarily-long levels of inactivity.
135 136 137 |
# File 'lib/submodules/ably-ruby/lib/ably/models/connection_details.rb', line 135 def max_idle_interval attributes[:max_idle_interval] end |
#max_inbound_rate ⇒ Integer
The maximum allowable number of requests per second from a client or Ably. In the case of a realtime connection, this restriction applies to the number of messages sent, whereas in the case of REST, it is the total number of REST requests per second.
101 102 103 |
# File 'lib/submodules/ably-ruby/lib/ably/models/connection_details.rb', line 101 def max_inbound_rate attributes[:max_inbound_rate] end |
#max_message_size ⇒ Integer
The maximum message size is an attribute of an Ably account and enforced by Ably servers. maxMessageSize indicates the maximum message size allowed by the Ably account this connection is using. Overrides the default value of ClientOptions.maxMessageSize.
113 114 115 |
# File 'lib/submodules/ably-ruby/lib/ably/models/connection_details.rb', line 113 def attributes[:max_message_size] end |
#server_id ⇒ String
A unique identifier for the front-end server that the client has connected to. This server ID is only used for the purposes of debugging.
123 124 125 |
# File 'lib/submodules/ably-ruby/lib/ably/models/connection_details.rb', line 123 def server_id attributes[:server_id] end |