ably 0.8.5 → 0.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/CHANGELOG.md +42 -48
  4. data/SPEC.md +1099 -640
  5. data/ably.gemspec +10 -4
  6. data/lib/ably/auth.rb +155 -47
  7. data/lib/ably/exceptions.rb +2 -0
  8. data/lib/ably/models/channel_state_change.rb +2 -3
  9. data/lib/ably/models/connection_details.rb +54 -0
  10. data/lib/ably/models/protocol_message.rb +14 -4
  11. data/lib/ably/models/token_details.rb +13 -7
  12. data/lib/ably/models/token_request.rb +1 -2
  13. data/lib/ably/modules/ably.rb +3 -2
  14. data/lib/ably/modules/message_emitter.rb +1 -3
  15. data/lib/ably/modules/state_emitter.rb +2 -2
  16. data/lib/ably/realtime/auth.rb +6 -0
  17. data/lib/ably/realtime/channel/channel_manager.rb +2 -0
  18. data/lib/ably/realtime/channel.rb +15 -4
  19. data/lib/ably/realtime/client/incoming_message_dispatcher.rb +11 -1
  20. data/lib/ably/realtime/client.rb +10 -3
  21. data/lib/ably/realtime/connection/connection_manager.rb +58 -54
  22. data/lib/ably/realtime/connection.rb +62 -6
  23. data/lib/ably/realtime/presence.rb +18 -5
  24. data/lib/ably/rest/channel.rb +9 -1
  25. data/lib/ably/rest/client.rb +32 -14
  26. data/lib/ably/rest/presence.rb +1 -1
  27. data/lib/ably/version.rb +1 -1
  28. data/lib/ably.rb +2 -0
  29. data/spec/acceptance/realtime/auth_spec.rb +251 -11
  30. data/spec/acceptance/realtime/channel_history_spec.rb +12 -2
  31. data/spec/acceptance/realtime/channel_spec.rb +316 -24
  32. data/spec/acceptance/realtime/client_spec.rb +93 -1
  33. data/spec/acceptance/realtime/connection_failures_spec.rb +177 -86
  34. data/spec/acceptance/realtime/connection_spec.rb +284 -60
  35. data/spec/acceptance/realtime/message_spec.rb +45 -6
  36. data/spec/acceptance/realtime/presence_history_spec.rb +4 -0
  37. data/spec/acceptance/realtime/presence_spec.rb +181 -49
  38. data/spec/acceptance/realtime/time_spec.rb +13 -0
  39. data/spec/acceptance/rest/auth_spec.rb +222 -4
  40. data/spec/acceptance/rest/channel_spec.rb +132 -1
  41. data/spec/acceptance/rest/client_spec.rb +129 -28
  42. data/spec/acceptance/rest/presence_spec.rb +7 -7
  43. data/spec/acceptance/rest/time_spec.rb +10 -0
  44. data/spec/shared/client_initializer_behaviour.rb +41 -17
  45. data/spec/spec_helper.rb +1 -0
  46. data/spec/support/debug_failure_helper.rb +16 -0
  47. data/spec/unit/models/connection_details_spec.rb +60 -0
  48. data/spec/unit/models/protocol_message_spec.rb +45 -0
  49. data/spec/unit/modules/event_emitter_spec.rb +3 -1
  50. data/spec/unit/realtime/channel_spec.rb +6 -5
  51. data/spec/unit/realtime/client_spec.rb +5 -1
  52. data/spec/unit/realtime/connection_spec.rb +5 -1
  53. data/spec/unit/realtime/realtime_spec.rb +5 -1
  54. metadata +54 -7
data/SPEC.md CHANGED
@@ -1,8 +1,8 @@
1
- # Ably Realtime & REST Client Library 0.8.2 Specification
1
+ # Ably Realtime & REST Client Library 0.8.6 Specification
2
2
 
3
3
  ### Ably::Realtime::Auth
4
4
  _(see [spec/acceptance/realtime/auth_spec.rb](./spec/acceptance/realtime/auth_spec.rb))_
5
- * using JSON and MsgPack protocol
5
+ * using JSON protocol
6
6
  * with basic auth
7
7
  * #authentication_security_requirements_met?
8
8
  * [returns true](./spec/acceptance/realtime/auth_spec.rb#L20)
@@ -19,45 +19,93 @@ _(see [spec/acceptance/realtime/auth_spec.rb](./spec/acceptance/realtime/auth_sp
19
19
  * with token auth
20
20
  * #client_id
21
21
  * [contains the ClientOptions client ID](./spec/acceptance/realtime/auth_spec.rb#L67)
22
- * #token
23
- * [contains the current token after auth](./spec/acceptance/realtime/auth_spec.rb#L76)
24
22
  * #current_token_details
25
- * [contains the current token after auth](./spec/acceptance/realtime/auth_spec.rb#L83)
23
+ * [contains the current token after auth](./spec/acceptance/realtime/auth_spec.rb#L74)
26
24
  * #token_renewable?
27
- * [is true when an API key exists](./spec/acceptance/realtime/auth_spec.rb#L93)
25
+ * [is true when an API key exists](./spec/acceptance/realtime/auth_spec.rb#L84)
28
26
  * #options (auth_options)
29
- * [contains the configured auth options](./spec/acceptance/realtime/auth_spec.rb#L103)
27
+ * [contains the configured auth options](./spec/acceptance/realtime/auth_spec.rb#L95)
30
28
  * #token_params
31
- * [contains the configured auth options](./spec/acceptance/realtime/auth_spec.rb#L114)
29
+ * [contains the configured auth options](./spec/acceptance/realtime/auth_spec.rb#L106)
32
30
  * #using_basic_auth?
33
- * [is false when using Token Auth](./spec/acceptance/realtime/auth_spec.rb#L123)
31
+ * [is false when using Token Auth](./spec/acceptance/realtime/auth_spec.rb#L115)
34
32
  * #using_token_auth?
35
- * [is true when using Token Auth](./spec/acceptance/realtime/auth_spec.rb#L132)
33
+ * [is true when using Token Auth](./spec/acceptance/realtime/auth_spec.rb#L124)
36
34
  *
37
35
  * #create_token_request
38
- * [returns a token request asynchronously](./spec/acceptance/realtime/auth_spec.rb#L146)
36
+ * [returns a token request asynchronously](./spec/acceptance/realtime/auth_spec.rb#L138)
39
37
  * #create_token_request_async
40
- * [returns a token request synchronously](./spec/acceptance/realtime/auth_spec.rb#L156)
38
+ * [returns a token request synchronously](./spec/acceptance/realtime/auth_spec.rb#L148)
41
39
  * #request_token
42
- * [returns a token asynchronously](./spec/acceptance/realtime/auth_spec.rb#L166)
40
+ * [returns a token asynchronously](./spec/acceptance/realtime/auth_spec.rb#L158)
43
41
  * #request_token_async
44
- * [returns a token synchronously](./spec/acceptance/realtime/auth_spec.rb#L177)
42
+ * [returns a token synchronously](./spec/acceptance/realtime/auth_spec.rb#L169)
45
43
  * #authorise
46
- * [returns a token asynchronously](./spec/acceptance/realtime/auth_spec.rb#L188)
44
+ * [returns a token asynchronously](./spec/acceptance/realtime/auth_spec.rb#L180)
45
+ * when implicitly called, with an explicit ClientOptions client_id
46
+ * and an incompatible client_id in a TokenDetails object passed to the auth callback
47
+ * [rejects a TokenDetails object with an incompatible client_id and raises an exception](./spec/acceptance/realtime/auth_spec.rb#L197)
48
+ * and an incompatible client_id in a TokenRequest object passed to the auth callback and raises an exception
49
+ * [rejects a TokenRequests object with an incompatible client_id and raises an exception](./spec/acceptance/realtime/auth_spec.rb#L212)
50
+ * when explicitly called, with an explicit ClientOptions client_id
51
+ * and an incompatible client_id in a TokenDetails object passed to the auth callback
52
+ * [rejects a TokenDetails object with an incompatible client_id and raises an exception](./spec/acceptance/realtime/auth_spec.rb#L243)
47
53
  * #authorise_async
48
- * [returns a token synchronously](./spec/acceptance/realtime/auth_spec.rb#L199)
49
- * #auth_params
50
- * [returns the auth params asynchronously](./spec/acceptance/realtime/auth_spec.rb#L211)
54
+ * [returns a token synchronously](./spec/acceptance/realtime/auth_spec.rb#L260)
51
55
  * #auth_params
52
- * [returns the auth params synchronously](./spec/acceptance/realtime/auth_spec.rb#L220)
53
- * #auth_header
54
- * [returns an auth header asynchronously](./spec/acceptance/realtime/auth_spec.rb#L227)
56
+ * [returns the auth params asynchronously](./spec/acceptance/realtime/auth_spec.rb#L272)
57
+ * #auth_params_sync
58
+ * [returns the auth params synchronously](./spec/acceptance/realtime/auth_spec.rb#L281)
55
59
  * #auth_header
56
- * [returns an auth header synchronously](./spec/acceptance/realtime/auth_spec.rb#L236)
60
+ * [returns an auth header asynchronously](./spec/acceptance/realtime/auth_spec.rb#L288)
61
+ * #auth_header_sync
62
+ * [returns an auth header synchronously](./spec/acceptance/realtime/auth_spec.rb#L297)
63
+ * #client_id_validated?
64
+ * when using basic auth
65
+ * before connected
66
+ * [is false as basic auth users do not have an identity](./spec/acceptance/realtime/auth_spec.rb#L310)
67
+ * once connected
68
+ * [is true](./spec/acceptance/realtime/auth_spec.rb#L317)
69
+ * [contains a validated wildcard client_id](./spec/acceptance/realtime/auth_spec.rb#L324)
70
+ * when using a token string
71
+ * with a valid client_id
72
+ * before connected
73
+ * [is false as identification is not possible from an opaque token string](./spec/acceptance/realtime/auth_spec.rb#L338)
74
+ * [#client_id is nil](./spec/acceptance/realtime/auth_spec.rb#L343)
75
+ * once connected
76
+ * [is true](./spec/acceptance/realtime/auth_spec.rb#L350)
77
+ * [#client_id is populated](./spec/acceptance/realtime/auth_spec.rb#L357)
78
+ * with no client_id (anonymous)
79
+ * before connected
80
+ * [is false as identification is not possible from an opaque token string](./spec/acceptance/realtime/auth_spec.rb#L370)
81
+ * once connected
82
+ * [is true](./spec/acceptance/realtime/auth_spec.rb#L377)
83
+ * with a wildcard client_id (anonymous)
84
+ * before connected
85
+ * [is false as identification is not possible from an opaque token string](./spec/acceptance/realtime/auth_spec.rb#L390)
86
+ * once connected
87
+ * [is true](./spec/acceptance/realtime/auth_spec.rb#L397)
88
+ * when using a token
89
+ * with a client_id
90
+ * [is true](./spec/acceptance/realtime/auth_spec.rb#L411)
91
+ * once connected
92
+ * [is true](./spec/acceptance/realtime/auth_spec.rb#L417)
93
+ * with no client_id (anonymous)
94
+ * [is true](./spec/acceptance/realtime/auth_spec.rb#L429)
95
+ * once connected
96
+ * [is true](./spec/acceptance/realtime/auth_spec.rb#L435)
97
+ * with a wildcard client_id (anonymous)
98
+ * [is true](./spec/acceptance/realtime/auth_spec.rb#L447)
99
+ * once connected
100
+ * [is true](./spec/acceptance/realtime/auth_spec.rb#L453)
101
+ * when using a token request with a client_id
102
+ * [is not true as identification is not confirmed until authenticated](./spec/acceptance/realtime/auth_spec.rb#L466)
103
+ * once connected
104
+ * [is true as identification is completed following CONNECTED ProtocolMessage](./spec/acceptance/realtime/auth_spec.rb#L472)
57
105
 
58
106
  ### Ably::Realtime::Channel#history
59
107
  _(see [spec/acceptance/realtime/channel_history_spec.rb](./spec/acceptance/realtime/channel_history_spec.rb))_
60
- * using JSON and MsgPack protocol
108
+ * using JSON protocol
61
109
  * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/channel_history_spec.rb#L21)
62
110
  * with a single client publishing and receiving
63
111
  * [retrieves realtime history](./spec/acceptance/realtime/channel_history_spec.rb#L34)
@@ -74,13 +122,13 @@ _(see [spec/acceptance/realtime/channel_history_spec.rb](./spec/acceptance/realt
74
122
  * [return the same results with unique matching message IDs](./spec/acceptance/realtime/channel_history_spec.rb#L135)
75
123
  * with option until_attach: true
76
124
  * [retrieves all messages before channel was attached](./spec/acceptance/realtime/channel_history_spec.rb#L160)
77
- * [raises an exception unless state is attached](./spec/acceptance/realtime/channel_history_spec.rb#L199)
125
+ * [raises an exception unless state is attached](./spec/acceptance/realtime/channel_history_spec.rb#L209)
78
126
  * and two pages of messages
79
127
  * [retrieves two pages of messages before channel was attached](./spec/acceptance/realtime/channel_history_spec.rb#L175)
80
128
 
81
129
  ### Ably::Realtime::Channel
82
130
  _(see [spec/acceptance/realtime/channel_spec.rb](./spec/acceptance/realtime/channel_spec.rb))_
83
- * using JSON and MsgPack protocol
131
+ * using JSON protocol
84
132
  * initialization
85
133
  * with :auto_connect option set to false on connection
86
134
  * [remains initialized when accessing a channel](./spec/acceptance/realtime/channel_spec.rb#L21)
@@ -108,113 +156,184 @@ _(see [spec/acceptance/realtime/channel_spec.rb](./spec/acceptance/realtime/chan
108
156
  * #detach
109
157
  * [detaches from a channel](./spec/acceptance/realtime/channel_spec.rb#L212)
110
158
  * [detaches from a channel and calls the provided block](./spec/acceptance/realtime/channel_spec.rb#L222)
111
- * [emits :detaching then :detached events](./spec/acceptance/realtime/channel_spec.rb#L231)
112
- * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/channel_spec.rb#L243)
113
- * [calls the Deferrable callback on success](./spec/acceptance/realtime/channel_spec.rb#L250)
159
+ * [emits :detaching then :detached events](./spec/acceptance/realtime/channel_spec.rb#L232)
160
+ * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/channel_spec.rb#L244)
161
+ * [calls the Deferrable callback on success](./spec/acceptance/realtime/channel_spec.rb#L251)
114
162
  * when state is :failed
115
- * [raises an exception](./spec/acceptance/realtime/channel_spec.rb#L263)
163
+ * [raises an exception](./spec/acceptance/realtime/channel_spec.rb#L264)
116
164
  * when state is :attaching
117
- * [moves straight to :detaching state and skips :attached](./spec/acceptance/realtime/channel_spec.rb#L274)
165
+ * [moves straight to :detaching state and skips :attached](./spec/acceptance/realtime/channel_spec.rb#L275)
118
166
  * when state is :detaching
119
- * [ignores subsequent #detach calls but calls the callback if provided](./spec/acceptance/realtime/channel_spec.rb#L292)
167
+ * [ignores subsequent #detach calls but calls the callback if provided](./spec/acceptance/realtime/channel_spec.rb#L293)
120
168
  * when state is :initialized
121
- * [does nothing as there is no channel to detach](./spec/acceptance/realtime/channel_spec.rb#L309)
122
- * [returns a valid deferrable](./spec/acceptance/realtime/channel_spec.rb#L317)
169
+ * [does nothing as there is no channel to detach](./spec/acceptance/realtime/channel_spec.rb#L310)
170
+ * [returns a valid deferrable](./spec/acceptance/realtime/channel_spec.rb#L318)
123
171
  * channel recovery in :attaching state
124
172
  * the transport is disconnected before the ATTACHED protocol message is received
125
- * PENDING: *[attach times out and fails if not ATTACHED protocol message received](./spec/acceptance/realtime/channel_spec.rb#L329)*
126
- * PENDING: *[channel is ATTACHED if ATTACHED protocol message is later received](./spec/acceptance/realtime/channel_spec.rb#L330)*
127
- * PENDING: *[sends an ATTACH protocol message in response to a channel message being received on the attaching channel](./spec/acceptance/realtime/channel_spec.rb#L331)*
173
+ * PENDING: *[attach times out and fails if not ATTACHED protocol message received](./spec/acceptance/realtime/channel_spec.rb#L330)*
174
+ * PENDING: *[channel is ATTACHED if ATTACHED protocol message is later received](./spec/acceptance/realtime/channel_spec.rb#L331)*
175
+ * PENDING: *[sends an ATTACH protocol message in response to a channel message being received on the attaching channel](./spec/acceptance/realtime/channel_spec.rb#L332)*
128
176
  * #publish
129
177
  * when attached
130
- * [publishes messages](./spec/acceptance/realtime/channel_spec.rb#L340)
178
+ * [publishes messages](./spec/acceptance/realtime/channel_spec.rb#L341)
131
179
  * when not yet attached
132
- * [publishes queued messages once attached](./spec/acceptance/realtime/channel_spec.rb#L352)
133
- * [publishes queued messages within a single protocol message](./spec/acceptance/realtime/channel_spec.rb#L360)
180
+ * [publishes queued messages once attached](./spec/acceptance/realtime/channel_spec.rb#L353)
181
+ * [publishes queued messages within a single protocol message](./spec/acceptance/realtime/channel_spec.rb#L361)
134
182
  * with :queue_messages client option set to false
135
183
  * and connection state initialized
136
- * [raises an exception](./spec/acceptance/realtime/channel_spec.rb#L383)
184
+ * [raises an exception](./spec/acceptance/realtime/channel_spec.rb#L384)
137
185
  * and connection state connecting
138
- * [raises an exception](./spec/acceptance/realtime/channel_spec.rb#L391)
186
+ * [raises an exception](./spec/acceptance/realtime/channel_spec.rb#L392)
139
187
  * and connection state disconnected
140
- * [raises an exception](./spec/acceptance/realtime/channel_spec.rb#L403)
188
+ * [raises an exception](./spec/acceptance/realtime/channel_spec.rb#L404)
141
189
  * and connection state connected
142
- * [publishes the message](./spec/acceptance/realtime/channel_spec.rb#L416)
190
+ * [publishes the message](./spec/acceptance/realtime/channel_spec.rb#L417)
143
191
  * with name and data arguments
144
- * [publishes the message and return true indicating success](./spec/acceptance/realtime/channel_spec.rb#L427)
192
+ * [publishes the message and return true indicating success](./spec/acceptance/realtime/channel_spec.rb#L428)
193
+ * and additional attributes
194
+ * [publishes the message with the attributes and return true indicating success](./spec/acceptance/realtime/channel_spec.rb#L441)
145
195
  * with an array of Hash objects with :name and :data attributes
146
- * [publishes an array of messages in one ProtocolMessage](./spec/acceptance/realtime/channel_spec.rb#L445)
196
+ * [publishes an array of messages in one ProtocolMessage](./spec/acceptance/realtime/channel_spec.rb#L459)
147
197
  * with an array of Message objects
148
- * [publishes an array of messages in one ProtocolMessage](./spec/acceptance/realtime/channel_spec.rb#L473)
198
+ * [publishes an array of messages in one ProtocolMessage](./spec/acceptance/realtime/channel_spec.rb#L487)
199
+ * nil attributes
200
+ * when name is nil
201
+ * [publishes the message without a name attribute in the payload](./spec/acceptance/realtime/channel_spec.rb#L511)
202
+ * when data is nil
203
+ * [publishes the message without a data attribute in the payload](./spec/acceptance/realtime/channel_spec.rb#L534)
204
+ * with neither name or data attributes
205
+ * [publishes the message without any attributes in the payload](./spec/acceptance/realtime/channel_spec.rb#L557)
149
206
  * with two invalid message out of 12
150
- * PENDING: *[calls the errback once](./spec/acceptance/realtime/channel_spec.rb#L501)*
207
+ * before client_id is known (validated)
208
+ * [calls the errback once](./spec/acceptance/realtime/channel_spec.rb#L581)
209
+ * when client_id is known (validated)
210
+ * [raises an exception](./spec/acceptance/realtime/channel_spec.rb#L601)
151
211
  * only invalid messages
152
- * PENDING: *[calls the errback once](./spec/acceptance/realtime/channel_spec.rb#L527)*
212
+ * before client_id is known (validated)
213
+ * [calls the errback once](./spec/acceptance/realtime/channel_spec.rb#L620)
214
+ * when client_id is known (validated)
215
+ * [raises an exception](./spec/acceptance/realtime/channel_spec.rb#L639)
153
216
  * with many many messages and many connections simultaneously
154
- * [publishes all messages, all success callbacks are called, and a history request confirms all messages were published](./spec/acceptance/realtime/channel_spec.rb#L551)
217
+ * [publishes all messages, all success callbacks are called, and a history request confirms all messages were published](./spec/acceptance/realtime/channel_spec.rb#L653)
218
+ * identified clients
219
+ * when authenticated with a wildcard client_id
220
+ * with a valid client_id in the message
221
+ * [succeeds](./spec/acceptance/realtime/channel_spec.rb#L681)
222
+ * with a wildcard client_id in the message
223
+ * [throws an exception](./spec/acceptance/realtime/channel_spec.rb#L693)
224
+ * with an empty client_id in the message
225
+ * [succeeds and publishes without a client_id](./spec/acceptance/realtime/channel_spec.rb#L700)
226
+ * when authenticated with a Token string with an implicit client_id
227
+ * before the client is CONNECTED and the client's identity has been obtained
228
+ * with a valid client_id in the message
229
+ * [succeeds](./spec/acceptance/realtime/channel_spec.rb#L720)
230
+ * with an invalid client_id in the message
231
+ * [succeeds in the client library but then fails when delivered to Ably](./spec/acceptance/realtime/channel_spec.rb#L733)
232
+ * with an empty client_id in the message
233
+ * [succeeds and publishes with an implicit client_id](./spec/acceptance/realtime/channel_spec.rb#L744)
234
+ * after the client is CONNECTED and the client's identity is known
235
+ * with a valid client_id in the message
236
+ * [succeeds](./spec/acceptance/realtime/channel_spec.rb#L758)
237
+ * with an invalid client_id in the message
238
+ * [throws an exception](./spec/acceptance/realtime/channel_spec.rb#L772)
239
+ * with an empty client_id in the message
240
+ * [succeeds and publishes with an implicit client_id](./spec/acceptance/realtime/channel_spec.rb#L781)
241
+ * when authenticated with a valid client_id
242
+ * with a valid client_id
243
+ * [succeeds](./spec/acceptance/realtime/channel_spec.rb#L803)
244
+ * with a wildcard client_id in the message
245
+ * [throws an exception](./spec/acceptance/realtime/channel_spec.rb#L815)
246
+ * with an invalid client_id in the message
247
+ * [throws an exception](./spec/acceptance/realtime/channel_spec.rb#L822)
248
+ * with an empty client_id in the message
249
+ * [succeeds and publishes with an implicit client_id](./spec/acceptance/realtime/channel_spec.rb#L829)
250
+ * when anonymous and no client_id
251
+ * with a client_id in the message
252
+ * [throws an exception](./spec/acceptance/realtime/channel_spec.rb#L848)
253
+ * with a wildcard client_id in the message
254
+ * [throws an exception](./spec/acceptance/realtime/channel_spec.rb#L855)
255
+ * with an empty client_id in the message
256
+ * [succeeds and publishes with an implicit client_id](./spec/acceptance/realtime/channel_spec.rb#L862)
155
257
  * #subscribe
156
258
  * with an event argument
157
- * [subscribes for a single event](./spec/acceptance/realtime/channel_spec.rb#L574)
259
+ * [subscribes for a single event](./spec/acceptance/realtime/channel_spec.rb#L878)
158
260
  * before attach
159
- * [receives messages as soon as attached](./spec/acceptance/realtime/channel_spec.rb#L584)
261
+ * [receives messages as soon as attached](./spec/acceptance/realtime/channel_spec.rb#L888)
160
262
  * with no event argument
161
- * [subscribes for all events](./spec/acceptance/realtime/channel_spec.rb#L598)
263
+ * [subscribes for all events](./spec/acceptance/realtime/channel_spec.rb#L902)
162
264
  * many times with different event names
163
- * [filters events accordingly to each callback](./spec/acceptance/realtime/channel_spec.rb#L608)
265
+ * [filters events accordingly to each callback](./spec/acceptance/realtime/channel_spec.rb#L912)
164
266
  * #unsubscribe
165
267
  * with an event argument
166
- * [unsubscribes for a single event](./spec/acceptance/realtime/channel_spec.rb#L631)
268
+ * [unsubscribes for a single event](./spec/acceptance/realtime/channel_spec.rb#L935)
167
269
  * with no event argument
168
- * [unsubscribes for a single event](./spec/acceptance/realtime/channel_spec.rb#L644)
270
+ * [unsubscribes for a single event](./spec/acceptance/realtime/channel_spec.rb#L948)
169
271
  * when connection state changes to
170
272
  * :failed
171
273
  * an :attached channel
172
- * [transitions state to :failed](./spec/acceptance/realtime/channel_spec.rb#L667)
173
- * [emits an error event on the channel](./spec/acceptance/realtime/channel_spec.rb#L678)
174
- * [updates the channel error_reason](./spec/acceptance/realtime/channel_spec.rb#L689)
274
+ * [transitions state to :failed](./spec/acceptance/realtime/channel_spec.rb#L971)
275
+ * [emits an error event on the channel](./spec/acceptance/realtime/channel_spec.rb#L983)
276
+ * [updates the channel error_reason](./spec/acceptance/realtime/channel_spec.rb#L994)
175
277
  * a :detached channel
176
- * [remains in the :detached state](./spec/acceptance/realtime/channel_spec.rb#L702)
278
+ * [remains in the :detached state](./spec/acceptance/realtime/channel_spec.rb#L1008)
177
279
  * a :failed channel
178
- * [remains in the :failed state and ignores the failure error](./spec/acceptance/realtime/channel_spec.rb#L722)
280
+ * [remains in the :failed state and ignores the failure error](./spec/acceptance/realtime/channel_spec.rb#L1028)
179
281
  * a channel ATTACH request
180
- * [raises an exception](./spec/acceptance/realtime/channel_spec.rb#L743)
282
+ * [raises an exception](./spec/acceptance/realtime/channel_spec.rb#L1049)
181
283
  * :closed
182
284
  * an :attached channel
183
- * [transitions state to :detached](./spec/acceptance/realtime/channel_spec.rb#L757)
285
+ * [transitions state to :detached](./spec/acceptance/realtime/channel_spec.rb#L1063)
184
286
  * a :detached channel
185
- * [remains in the :detached state](./spec/acceptance/realtime/channel_spec.rb#L768)
287
+ * [remains in the :detached state](./spec/acceptance/realtime/channel_spec.rb#L1074)
186
288
  * a :failed channel
187
- * [remains in the :failed state and retains the error_reason](./spec/acceptance/realtime/channel_spec.rb#L789)
289
+ * [remains in the :failed state and retains the error_reason](./spec/acceptance/realtime/channel_spec.rb#L1095)
188
290
  * a channel ATTACH request when connection CLOSED
189
- * [raises an exception](./spec/acceptance/realtime/channel_spec.rb#L810)
291
+ * [raises an exception](./spec/acceptance/realtime/channel_spec.rb#L1116)
190
292
  * a channel ATTACH request when connection CLOSING
191
- * [raises an exception](./spec/acceptance/realtime/channel_spec.rb#L822)
293
+ * [raises an exception](./spec/acceptance/realtime/channel_spec.rb#L1128)
294
+ * :suspended
295
+ * an :attached channel
296
+ * [transitions state to :detached](./spec/acceptance/realtime/channel_spec.rb#L1144)
297
+ * a :detached channel
298
+ * [remains in the :detached state](./spec/acceptance/realtime/channel_spec.rb#L1155)
299
+ * a :failed channel
300
+ * [remains in the :failed state and retains the error_reason](./spec/acceptance/realtime/channel_spec.rb#L1176)
301
+ * a channel ATTACH request when connection SUSPENDED
302
+ * [raises an exception](./spec/acceptance/realtime/channel_spec.rb#L1199)
192
303
  * #presence
193
- * [returns a Ably::Realtime::Presence object](./spec/acceptance/realtime/channel_spec.rb#L836)
304
+ * [returns a Ably::Realtime::Presence object](./spec/acceptance/realtime/channel_spec.rb#L1213)
305
+ * channel state change
306
+ * [emits a ChannelStateChange object](./spec/acceptance/realtime/channel_spec.rb#L1220)
307
+ * ChannelStateChange object
308
+ * [has current state](./spec/acceptance/realtime/channel_spec.rb#L1229)
309
+ * [has a previous state](./spec/acceptance/realtime/channel_spec.rb#L1237)
310
+ * [has an empty reason when there is no error](./spec/acceptance/realtime/channel_spec.rb#L1254)
311
+ * on failure
312
+ * [has a reason Error object when there is an error on the channel](./spec/acceptance/realtime/channel_spec.rb#L1267)
194
313
 
195
314
  ### Ably::Realtime::Channels
196
315
  _(see [spec/acceptance/realtime/channels_spec.rb](./spec/acceptance/realtime/channels_spec.rb))_
197
- * using JSON and MsgPack protocol
316
+ * using JSON protocol
198
317
  * using shortcut method #channel on the client object
199
318
  * behaves like a channel
200
319
  * [returns a channel object](./spec/acceptance/realtime/channels_spec.rb#L6)
201
- * [returns channel object and passes the provided options](./spec/acceptance/realtime/channels_spec.rb#L11)
320
+ * [returns channel object and passes the provided options](./spec/acceptance/realtime/channels_spec.rb#L12)
202
321
  * using #get method on client#channels
203
322
  * behaves like a channel
204
323
  * [returns a channel object](./spec/acceptance/realtime/channels_spec.rb#L6)
205
- * [returns channel object and passes the provided options](./spec/acceptance/realtime/channels_spec.rb#L11)
324
+ * [returns channel object and passes the provided options](./spec/acceptance/realtime/channels_spec.rb#L12)
206
325
  * accessing an existing channel object with different options
207
- * [overrides the existing channel options and returns the channel object](./spec/acceptance/realtime/channels_spec.rb#L39)
326
+ * [overrides the existing channel options and returns the channel object](./spec/acceptance/realtime/channels_spec.rb#L41)
208
327
  * accessing an existing channel object without specifying any channel options
209
- * [returns the existing channel without modifying the channel options](./spec/acceptance/realtime/channels_spec.rb#L50)
328
+ * [returns the existing channel without modifying the channel options](./spec/acceptance/realtime/channels_spec.rb#L53)
210
329
  * using undocumented array accessor [] method on client#channels
211
330
  * behaves like a channel
212
331
  * [returns a channel object](./spec/acceptance/realtime/channels_spec.rb#L6)
213
- * [returns channel object and passes the provided options](./spec/acceptance/realtime/channels_spec.rb#L11)
332
+ * [returns channel object and passes the provided options](./spec/acceptance/realtime/channels_spec.rb#L12)
214
333
 
215
334
  ### Ably::Realtime::Client
216
335
  _(see [spec/acceptance/realtime/client_spec.rb](./spec/acceptance/realtime/client_spec.rb))_
217
- * using JSON and MsgPack protocol
336
+ * using JSON protocol
218
337
  * initialization
219
338
  * basic auth
220
339
  * [is enabled by default with a provided :key option](./spec/acceptance/realtime/client_spec.rb#L18)
@@ -224,96 +343,117 @@ _(see [spec/acceptance/realtime/client_spec.rb](./spec/acceptance/realtime/clien
224
343
  * token auth
225
344
  * with TLS enabled
226
345
  * and a pre-generated Token provided with the :token option
227
- * [connects using token auth](./spec/acceptance/realtime/client_spec.rb#L51)
346
+ * [connects using token auth](./spec/acceptance/realtime/client_spec.rb#L52)
228
347
  * with valid :key and :use_token_auth option set to true
229
- * [automatically authorises on connect and generates a token](./spec/acceptance/realtime/client_spec.rb#L64)
348
+ * [automatically authorises on connect and generates a token](./spec/acceptance/realtime/client_spec.rb#L65)
230
349
  * with client_id
231
- * [connects using token auth](./spec/acceptance/realtime/client_spec.rb#L77)
350
+ * [connects using token auth](./spec/acceptance/realtime/client_spec.rb#L78)
232
351
  * with TLS disabled
233
352
  * and a pre-generated Token provided with the :token option
234
- * [connects using token auth](./spec/acceptance/realtime/client_spec.rb#L51)
353
+ * [connects using token auth](./spec/acceptance/realtime/client_spec.rb#L52)
235
354
  * with valid :key and :use_token_auth option set to true
236
- * [automatically authorises on connect and generates a token](./spec/acceptance/realtime/client_spec.rb#L64)
355
+ * [automatically authorises on connect and generates a token](./spec/acceptance/realtime/client_spec.rb#L65)
237
356
  * with client_id
238
- * [connects using token auth](./spec/acceptance/realtime/client_spec.rb#L77)
357
+ * [connects using token auth](./spec/acceptance/realtime/client_spec.rb#L78)
239
358
  * with a Proc for the :auth_callback option
240
- * [calls the Proc](./spec/acceptance/realtime/client_spec.rb#L102)
241
- * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/realtime/client_spec.rb#L109)
359
+ * [calls the Proc](./spec/acceptance/realtime/client_spec.rb#L103)
360
+ * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/realtime/client_spec.rb#L110)
361
+ * when the returned token has a client_id
362
+ * [sets Auth#client_id to the new token's client_id immediately when connecting](./spec/acceptance/realtime/client_spec.rb#L118)
363
+ * [sets Client#client_id to the new token's client_id immediately when connecting](./spec/acceptance/realtime/client_spec.rb#L126)
364
+ * with a wildcard client_id token
365
+ * and an explicit client_id in ClientOptions
366
+ * [allows uses the explicit client_id in the connection](./spec/acceptance/realtime/client_spec.rb#L144)
367
+ * and client_id omitted in ClientOptions
368
+ * [uses the token provided clientId in the connection](./spec/acceptance/realtime/client_spec.rb#L160)
369
+ * with an invalid wildcard "*" :client_id
370
+ * [raises an exception](./spec/acceptance/realtime/client_spec.rb#L176)
371
+ * realtime connection settings
372
+ * defaults
373
+ * [disconnected_retry_timeout is 15s](./spec/acceptance/realtime/client_spec.rb#L185)
374
+ * [suspended_retry_timeout is 30s](./spec/acceptance/realtime/client_spec.rb#L190)
375
+ * overriden in ClientOptions
376
+ * [disconnected_retry_timeout is updated](./spec/acceptance/realtime/client_spec.rb#L199)
377
+ * [suspended_retry_timeout is updated](./spec/acceptance/realtime/client_spec.rb#L204)
242
378
  * #connection
243
- * [provides access to the Connection object](./spec/acceptance/realtime/client_spec.rb#L120)
379
+ * [provides access to the Connection object](./spec/acceptance/realtime/client_spec.rb#L213)
244
380
  * #channels
245
- * [provides access to the Channels collection object](./spec/acceptance/realtime/client_spec.rb#L127)
381
+ * [provides access to the Channels collection object](./spec/acceptance/realtime/client_spec.rb#L220)
246
382
  * #auth
247
- * [provides access to the Realtime::Auth object](./spec/acceptance/realtime/client_spec.rb#L134)
383
+ * [provides access to the Realtime::Auth object](./spec/acceptance/realtime/client_spec.rb#L227)
248
384
 
249
385
  ### Ably::Realtime::Connection failures
250
386
  _(see [spec/acceptance/realtime/connection_failures_spec.rb](./spec/acceptance/realtime/connection_failures_spec.rb))_
251
- * using JSON and MsgPack protocol
387
+ * using JSON protocol
252
388
  * authentication failure
253
389
  * when API key is invalid
254
390
  * with invalid app part of the key
255
391
  * [enters the failed state and returns a not found error](./spec/acceptance/realtime/connection_failures_spec.rb#L26)
256
392
  * with invalid key name part of the key
257
- * [enters the failed state and returns an authorization error](./spec/acceptance/realtime/connection_failures_spec.rb#L40)
393
+ * [enters the failed state and returns an authorization error](./spec/acceptance/realtime/connection_failures_spec.rb#L41)
258
394
  * automatic connection retry
259
395
  * with invalid WebSocket host
260
396
  * when disconnected
261
397
  * [enters the suspended state after multiple attempts to connect](./spec/acceptance/realtime/connection_failures_spec.rb#L95)
398
+ * for the first time
399
+ * [reattempts connection immediately and then waits disconnected_retry_timeout for a subsequent attempt](./spec/acceptance/realtime/connection_failures_spec.rb#L116)
262
400
  * #close
263
- * [transitions connection state to :closed](./spec/acceptance/realtime/connection_failures_spec.rb#L112)
401
+ * [transitions connection state to :closed](./spec/acceptance/realtime/connection_failures_spec.rb#L133)
264
402
  * when connection state is :suspended
265
- * [enters the failed state after multiple attempts if the max_time_in_state is set](./spec/acceptance/realtime/connection_failures_spec.rb#L131)
403
+ * [stays in the suspended state after any number of reconnection attempts](./spec/acceptance/realtime/connection_failures_spec.rb#L152)
404
+ * for the first time
405
+ * [waits suspended_retry_timeout before attempting to reconnect](./spec/acceptance/realtime/connection_failures_spec.rb#L175)
266
406
  * #close
267
- * [transitions connection state to :closed](./spec/acceptance/realtime/connection_failures_spec.rb#L151)
407
+ * [transitions connection state to :closed](./spec/acceptance/realtime/connection_failures_spec.rb#L197)
268
408
  * when connection state is :failed
269
409
  * #close
270
- * [will not transition state to :close and raises a InvalidStateChange exception](./spec/acceptance/realtime/connection_failures_spec.rb#L170)
410
+ * [will not transition state to :close and raises a InvalidStateChange exception](./spec/acceptance/realtime/connection_failures_spec.rb#L216)
271
411
  * #error_reason
272
- * [contains the error when state is disconnected](./spec/acceptance/realtime/connection_failures_spec.rb#L184)
273
- * [contains the error when state is suspended](./spec/acceptance/realtime/connection_failures_spec.rb#L184)
274
- * [contains the error when state is failed](./spec/acceptance/realtime/connection_failures_spec.rb#L184)
275
- * [is reset to nil when :connected](./spec/acceptance/realtime/connection_failures_spec.rb#L193)
276
- * [is reset to nil when :closed](./spec/acceptance/realtime/connection_failures_spec.rb#L204)
412
+ * [contains the error when state is disconnected](./spec/acceptance/realtime/connection_failures_spec.rb#L234)
413
+ * [contains the error when state is suspended](./spec/acceptance/realtime/connection_failures_spec.rb#L234)
414
+ * [contains the error when state is failed](./spec/acceptance/realtime/connection_failures_spec.rb#L234)
415
+ * [is reset to nil when :connected](./spec/acceptance/realtime/connection_failures_spec.rb#L248)
416
+ * [is reset to nil when :closed](./spec/acceptance/realtime/connection_failures_spec.rb#L259)
277
417
  * #connect
278
418
  * connection opening times out
279
- * [attempts to reconnect](./spec/acceptance/realtime/connection_failures_spec.rb#L233)
280
- * [calls the errback of the returned Deferrable object when first connection attempt fails](./spec/acceptance/realtime/connection_failures_spec.rb#L246)
419
+ * [attempts to reconnect](./spec/acceptance/realtime/connection_failures_spec.rb#L290)
281
420
  * when retry intervals are stubbed to attempt reconnection quickly
282
- * [never calls the provided success block](./spec/acceptance/realtime/connection_failures_spec.rb#L263)
421
+ * [never calls the provided success block](./spec/acceptance/realtime/connection_failures_spec.rb#L314)
283
422
  * connection resume
284
423
  * when DISCONNECTED ProtocolMessage received from the server
285
- * [reconnects automatically and immediately](./spec/acceptance/realtime/connection_failures_spec.rb#L292)
424
+ * [reconnects automatically and immediately](./spec/acceptance/realtime/connection_failures_spec.rb#L345)
286
425
  * and subsequently fails to reconnect
287
- * [retries every 15 seconds](./spec/acceptance/realtime/connection_failures_spec.rb#L322)
426
+ * [retries every 15 seconds](./spec/acceptance/realtime/connection_failures_spec.rb#L377)
288
427
  * when websocket transport is closed
289
- * [reconnects automatically](./spec/acceptance/realtime/connection_failures_spec.rb#L365)
428
+ * [reconnects automatically](./spec/acceptance/realtime/connection_failures_spec.rb#L420)
290
429
  * after successfully reconnecting and resuming
291
- * [retains connection_id and connection_key](./spec/acceptance/realtime/connection_failures_spec.rb#L382)
292
- * [retains channel subscription state](./spec/acceptance/realtime/connection_failures_spec.rb#L399)
430
+ * [retains connection_id and updates the connection_key](./spec/acceptance/realtime/connection_failures_spec.rb#L437)
431
+ * [emits any error received from Ably but leaves the channels attached](./spec/acceptance/realtime/connection_failures_spec.rb#L452)
432
+ * [retains channel subscription state](./spec/acceptance/realtime/connection_failures_spec.rb#L483)
293
433
  * when messages were published whilst the client was disconnected
294
- * [receives the messages published whilst offline](./spec/acceptance/realtime/connection_failures_spec.rb#L429)
434
+ * [receives the messages published whilst offline](./spec/acceptance/realtime/connection_failures_spec.rb#L513)
295
435
  * when failing to resume
296
436
  * because the connection_key is not or no longer valid
297
- * [updates the connection_id and connection_key](./spec/acceptance/realtime/connection_failures_spec.rb#L470)
298
- * [detaches all channels](./spec/acceptance/realtime/connection_failures_spec.rb#L485)
299
- * [emits an error on the channel and sets the error reason](./spec/acceptance/realtime/connection_failures_spec.rb#L504)
437
+ * [updates the connection_id and connection_key](./spec/acceptance/realtime/connection_failures_spec.rb#L556)
438
+ * [detaches all channels](./spec/acceptance/realtime/connection_failures_spec.rb#L571)
439
+ * [emits an error on the channel and sets the error reason](./spec/acceptance/realtime/connection_failures_spec.rb#L591)
300
440
  * fallback host feature
301
441
  * with custom realtime websocket host option
302
- * [never uses a fallback host](./spec/acceptance/realtime/connection_failures_spec.rb#L543)
442
+ * [never uses a fallback host](./spec/acceptance/realtime/connection_failures_spec.rb#L631)
303
443
  * with custom realtime websocket port option
304
- * [never uses a fallback host](./spec/acceptance/realtime/connection_failures_spec.rb#L559)
444
+ * [never uses a fallback host](./spec/acceptance/realtime/connection_failures_spec.rb#L649)
305
445
  * with non-production environment
306
- * [never uses a fallback host](./spec/acceptance/realtime/connection_failures_spec.rb#L576)
446
+ * [never uses a fallback host](./spec/acceptance/realtime/connection_failures_spec.rb#L668)
307
447
  * with production environment
308
448
  * when the Internet is down
309
- * [never uses a fallback host](./spec/acceptance/realtime/connection_failures_spec.rb#L604)
449
+ * [never uses a fallback host](./spec/acceptance/realtime/connection_failures_spec.rb#L698)
310
450
  * when the Internet is up
311
- * [uses a fallback host on every subsequent disconnected attempt until suspended](./spec/acceptance/realtime/connection_failures_spec.rb#L621)
312
- * [uses the primary host when suspended, and a fallback host on every subsequent suspended attempt](./spec/acceptance/realtime/connection_failures_spec.rb#L640)
451
+ * [uses a fallback host on every subsequent disconnected attempt until suspended](./spec/acceptance/realtime/connection_failures_spec.rb#L717)
452
+ * [uses the primary host when suspended, and a fallback host on every subsequent suspended attempt](./spec/acceptance/realtime/connection_failures_spec.rb#L736)
313
453
 
314
454
  ### Ably::Realtime::Connection
315
455
  _(see [spec/acceptance/realtime/connection_spec.rb](./spec/acceptance/realtime/connection_spec.rb))_
316
- * using JSON and MsgPack protocol
456
+ * using JSON protocol
317
457
  * intialization
318
458
  * [connects automatically](./spec/acceptance/realtime/connection_spec.rb#L23)
319
459
  * with :auto_connect option set to false
@@ -328,128 +468,159 @@ _(see [spec/acceptance/realtime/connection_spec.rb](./spec/acceptance/realtime/c
328
468
  * [uses the token created by the implicit authorisation](./spec/acceptance/realtime/connection_spec.rb#L76)
329
469
  * that expire
330
470
  * opening a new connection
331
- * with recently expired token
332
- * [renews the token on connect without changing connection state](./spec/acceptance/realtime/connection_spec.rb#L108)
333
- * with immediately expiring token
334
- * [renews the token on connect, and only makes one subsequent attempt to obtain a new token](./spec/acceptance/realtime/connection_spec.rb#L127)
335
- * [uses the primary host for subsequent connection and auth requests](./spec/acceptance/realtime/connection_spec.rb#L137)
471
+ * with almost expired tokens
472
+ * [renews token every time after it expires](./spec/acceptance/realtime/connection_spec.rb#L110)
473
+ * with immediately expired token
474
+ * [renews the token on connect, and makes one immediate subsequent attempt to obtain a new token](./spec/acceptance/realtime/connection_spec.rb#L140)
475
+ * when disconnected_retry_timeout is 0.5 seconds
476
+ * [renews the token on connect, and continues to attempt renew based on the retry schedule](./spec/acceptance/realtime/connection_spec.rb#L155)
477
+ * using implicit token auth
478
+ * [uses the primary host for subsequent connection and auth requests](./spec/acceptance/realtime/connection_spec.rb#L177)
336
479
  * when connected with a valid non-expired token
337
480
  * that then expires following the connection being opened
338
- * PENDING: *[retains connection state](./spec/acceptance/realtime/connection_spec.rb#L193)*
339
- * PENDING: *[changes state to failed if a new token cannot be issued](./spec/acceptance/realtime/connection_spec.rb#L194)*
340
481
  * the server
341
- * [disconnects the client, and the client automatically renews the token and then reconnects](./spec/acceptance/realtime/connection_spec.rb#L164)
482
+ * [disconnects the client, and the client automatically renews the token and then reconnects](./spec/acceptance/realtime/connection_spec.rb#L204)
483
+ * connection state
484
+ * [retains messages published when disconnected twice during authentication](./spec/acceptance/realtime/connection_spec.rb#L273)
485
+ * and subsequent token is invalid
486
+ * [transitions the connection to the failed state](./spec/acceptance/realtime/connection_spec.rb#L302)
342
487
  * for non-renewable tokens
343
488
  * that are expired
344
489
  * opening a new connection
345
- * [transitions state to failed](./spec/acceptance/realtime/connection_spec.rb#L214)
490
+ * [transitions state to failed](./spec/acceptance/realtime/connection_spec.rb#L331)
346
491
  * when connected
347
- * PENDING: *[transitions state to failed](./spec/acceptance/realtime/connection_spec.rb#L227)*
492
+ * PENDING: *[transitions state to failed](./spec/acceptance/realtime/connection_spec.rb#L344)*
493
+ * with opaque token string that contain an implicit client_id
494
+ * string
495
+ * [sets the Client#client_id and Auth#client_id once CONNECTED](./spec/acceptance/realtime/connection_spec.rb#L357)
496
+ * that is incompatible with the current client client_id
497
+ * [fails the connection](./spec/acceptance/realtime/connection_spec.rb#L369)
498
+ * wildcard
499
+ * [configures the Client#client_id and Auth#client_id with a wildcard once CONNECTED](./spec/acceptance/realtime/connection_spec.rb#L383)
348
500
  * initialization state changes
349
501
  * with implicit #connect
350
- * [are emitted in order](./spec/acceptance/realtime/connection_spec.rb#L254)
502
+ * [are emitted in order](./spec/acceptance/realtime/connection_spec.rb#L415)
351
503
  * with explicit #connect
352
- * [are emitted in order](./spec/acceptance/realtime/connection_spec.rb#L260)
504
+ * [are emitted in order](./spec/acceptance/realtime/connection_spec.rb#L421)
353
505
  * #connect
354
- * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/connection_spec.rb#L268)
355
- * [calls the Deferrable callback on success](./spec/acceptance/realtime/connection_spec.rb#L273)
506
+ * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/connection_spec.rb#L429)
507
+ * [calls the Deferrable callback on success](./spec/acceptance/realtime/connection_spec.rb#L434)
508
+ * [calls the provided block on success even if state changes to disconnected first](./spec/acceptance/realtime/connection_spec.rb#L441)
509
+ * with invalid auth details
510
+ * [calls the Deferrable errback only once on connection failure](./spec/acceptance/realtime/connection_spec.rb#L470)
356
511
  * when already connected
357
- * [does nothing and no further state changes are emitted](./spec/acceptance/realtime/connection_spec.rb#L282)
512
+ * [does nothing and no further state changes are emitted](./spec/acceptance/realtime/connection_spec.rb#L486)
358
513
  * connection#id
359
- * [is null before connecting](./spec/acceptance/realtime/connection_spec.rb#L296)
514
+ * [is null before connecting](./spec/acceptance/realtime/connection_spec.rb#L500)
360
515
  * connection#key
361
- * [is null before connecting](./spec/acceptance/realtime/connection_spec.rb#L303)
516
+ * [is null before connecting](./spec/acceptance/realtime/connection_spec.rb#L507)
362
517
  * once connected
363
518
  * connection#id
364
- * [is a string](./spec/acceptance/realtime/connection_spec.rb#L313)
365
- * [is unique from the connection#key](./spec/acceptance/realtime/connection_spec.rb#L320)
366
- * [is unique for every connection](./spec/acceptance/realtime/connection_spec.rb#L327)
519
+ * [is a string](./spec/acceptance/realtime/connection_spec.rb#L518)
520
+ * [is unique from the connection#key](./spec/acceptance/realtime/connection_spec.rb#L525)
521
+ * [is unique for every connection](./spec/acceptance/realtime/connection_spec.rb#L532)
367
522
  * connection#key
368
- * [is a string](./spec/acceptance/realtime/connection_spec.rb#L336)
369
- * [is unique from the connection#id](./spec/acceptance/realtime/connection_spec.rb#L343)
370
- * [is unique for every connection](./spec/acceptance/realtime/connection_spec.rb#L350)
523
+ * [is a string](./spec/acceptance/realtime/connection_spec.rb#L541)
524
+ * [is unique from the connection#id](./spec/acceptance/realtime/connection_spec.rb#L548)
525
+ * [is unique for every connection](./spec/acceptance/realtime/connection_spec.rb#L555)
371
526
  * following a previous connection being opened and closed
372
- * [reconnects and is provided with a new connection ID and connection key from the server](./spec/acceptance/realtime/connection_spec.rb#L360)
527
+ * [reconnects and is provided with a new connection ID and connection key from the server](./spec/acceptance/realtime/connection_spec.rb#L565)
373
528
  * when closing
374
- * [raises an exception before the connection is closed](./spec/acceptance/realtime/connection_spec.rb#L377)
529
+ * [raises an exception before the connection is closed](./spec/acceptance/realtime/connection_spec.rb#L582)
375
530
  * #serial connection serial
376
- * [is set to -1 when a new connection is opened](./spec/acceptance/realtime/connection_spec.rb#L392)
377
- * [is set to 0 when a message sent ACK is received](./spec/acceptance/realtime/connection_spec.rb#L413)
378
- * [is set to 1 when the second message sent ACK is received](./spec/acceptance/realtime/connection_spec.rb#L420)
531
+ * [is set to -1 when a new connection is opened](./spec/acceptance/realtime/connection_spec.rb#L597)
532
+ * [is set to 0 when a message sent ACK is received](./spec/acceptance/realtime/connection_spec.rb#L618)
533
+ * [is set to 1 when the second message sent ACK is received](./spec/acceptance/realtime/connection_spec.rb#L625)
379
534
  * when a message is sent but the ACK has not yet been received
380
- * [the sent message msgSerial is 0 but the connection serial remains at -1](./spec/acceptance/realtime/connection_spec.rb#L400)
535
+ * [the sent message msgSerial is 0 but the connection serial remains at -1](./spec/acceptance/realtime/connection_spec.rb#L605)
381
536
  * #close
382
- * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/connection_spec.rb#L431)
383
- * [calls the Deferrable callback on success](./spec/acceptance/realtime/connection_spec.rb#L438)
537
+ * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/connection_spec.rb#L636)
538
+ * [calls the Deferrable callback on success](./spec/acceptance/realtime/connection_spec.rb#L643)
384
539
  * when already closed
385
- * [does nothing and no further state changes are emitted](./spec/acceptance/realtime/connection_spec.rb#L449)
540
+ * [does nothing and no further state changes are emitted](./spec/acceptance/realtime/connection_spec.rb#L654)
386
541
  * when connection state is
387
542
  * :initialized
388
- * [changes the connection state to :closing and then immediately :closed without sending a ProtocolMessage CLOSE](./spec/acceptance/realtime/connection_spec.rb#L477)
543
+ * [changes the connection state to :closing and then immediately :closed without sending a ProtocolMessage CLOSE](./spec/acceptance/realtime/connection_spec.rb#L682)
389
544
  * :connected
390
- * [changes the connection state to :closing and waits for the server to confirm connection is :closed with a ProtocolMessage](./spec/acceptance/realtime/connection_spec.rb#L495)
545
+ * [changes the connection state to :closing and waits for the server to confirm connection is :closed with a ProtocolMessage](./spec/acceptance/realtime/connection_spec.rb#L700)
391
546
  * with an unresponsive connection
392
- * [force closes the connection when a :closed ProtocolMessage response is not received](./spec/acceptance/realtime/connection_spec.rb#L525)
547
+ * [force closes the connection when a :closed ProtocolMessage response is not received](./spec/acceptance/realtime/connection_spec.rb#L728)
393
548
  * #ping
394
- * [echoes a heart beat](./spec/acceptance/realtime/connection_spec.rb#L548)
549
+ * [echoes a heart beat](./spec/acceptance/realtime/connection_spec.rb#L751)
395
550
  * when not connected
396
- * [raises an exception](./spec/acceptance/realtime/connection_spec.rb#L558)
551
+ * [raises an exception](./spec/acceptance/realtime/connection_spec.rb#L761)
397
552
  * with a success block that raises an exception
398
- * [catches the exception and logs the error](./spec/acceptance/realtime/connection_spec.rb#L565)
553
+ * [catches the exception and logs the error](./spec/acceptance/realtime/connection_spec.rb#L768)
554
+ * when ping times out
555
+ * [logs a warning](./spec/acceptance/realtime/connection_spec.rb#L781)
556
+ * [yields to the block with a nil value](./spec/acceptance/realtime/connection_spec.rb#L791)
399
557
  * recovery
400
558
  * #recovery_key
401
- * [is composed of connection key and serial that is kept up to date with each message ACK received](./spec/acceptance/realtime/connection_spec.rb#L602)
402
- * [is available when connection is in one of the states: connecting, connected, disconnected, suspended, failed](./spec/acceptance/realtime/connection_spec.rb#L625)
403
- * [is nil when connection is explicitly CLOSED](./spec/acceptance/realtime/connection_spec.rb#L649)
559
+ * [is composed of connection key and serial that is kept up to date with each message ACK received](./spec/acceptance/realtime/connection_spec.rb#L828)
560
+ * [is available when connection is in one of the states: connecting, connected, disconnected, suspended, failed](./spec/acceptance/realtime/connection_spec.rb#L851)
561
+ * [is nil when connection is explicitly CLOSED](./spec/acceptance/realtime/connection_spec.rb#L880)
404
562
  * opening a new connection using a recently disconnected connection's #recovery_key
405
563
  * connection#id and connection#key after recovery
406
- * [remains the same](./spec/acceptance/realtime/connection_spec.rb#L663)
564
+ * [remains the same](./spec/acceptance/realtime/connection_spec.rb#L892)
407
565
  * when messages have been sent whilst the old connection is disconnected
408
566
  * the new connection
409
- * [recovers server-side queued messages](./spec/acceptance/realtime/connection_spec.rb#L704)
567
+ * [recovers server-side queued messages](./spec/acceptance/realtime/connection_spec.rb#L932)
410
568
  * with :recover option
411
569
  * with invalid syntax
412
- * [raises an exception](./spec/acceptance/realtime/connection_spec.rb#L729)
570
+ * [raises an exception](./spec/acceptance/realtime/connection_spec.rb#L958)
413
571
  * with invalid formatted value sent to server
414
- * [emits a fatal error on the connection object, sets the #error_reason and disconnects](./spec/acceptance/realtime/connection_spec.rb#L738)
572
+ * [emits a fatal error on the connection object, sets the #error_reason and disconnects](./spec/acceptance/realtime/connection_spec.rb#L967)
415
573
  * with expired (missing) value sent to server
416
- * [emits an error on the connection object, sets the #error_reason, yet will connect anyway](./spec/acceptance/realtime/connection_spec.rb#L753)
574
+ * [emits an error on the connection object, sets the #error_reason, yet will connect anyway](./spec/acceptance/realtime/connection_spec.rb#L982)
417
575
  * with many connections simultaneously
418
- * [opens each with a unique connection#id and connection#key](./spec/acceptance/realtime/connection_spec.rb#L772)
576
+ * [opens each with a unique connection#id and connection#key](./spec/acceptance/realtime/connection_spec.rb#L1001)
419
577
  * when a state transition is unsupported
420
- * [emits a InvalidStateChange](./spec/acceptance/realtime/connection_spec.rb#L792)
578
+ * [emits a InvalidStateChange](./spec/acceptance/realtime/connection_spec.rb#L1021)
421
579
  * protocol failure
422
580
  * receiving an invalid ProtocolMessage
423
- * [emits an error on the connection and logs a fatal error message](./spec/acceptance/realtime/connection_spec.rb#L808)
581
+ * [emits an error on the connection and logs a fatal error message](./spec/acceptance/realtime/connection_spec.rb#L1037)
424
582
  * undocumented method
425
583
  * #internet_up?
426
- * [returns a Deferrable](./spec/acceptance/realtime/connection_spec.rb#L824)
584
+ * [returns a Deferrable](./spec/acceptance/realtime/connection_spec.rb#L1053)
427
585
  * internet up URL protocol
428
586
  * when using TLS for the connection
429
- * [uses TLS for the Internet check to https://internet-up.ably-realtime.com/is-the-internet-up.txt](./spec/acceptance/realtime/connection_spec.rb#L835)
587
+ * [uses TLS for the Internet check to https://internet-up.ably-realtime.com/is-the-internet-up.txt](./spec/acceptance/realtime/connection_spec.rb#L1064)
430
588
  * when using a non-secured connection
431
- * [uses TLS for the Internet check to http://internet-up.ably-realtime.com/is-the-internet-up.txt](./spec/acceptance/realtime/connection_spec.rb#L845)
589
+ * [uses TLS for the Internet check to http://internet-up.ably-realtime.com/is-the-internet-up.txt](./spec/acceptance/realtime/connection_spec.rb#L1074)
432
590
  * when the Internet is up
433
- * [calls the block with true](./spec/acceptance/realtime/connection_spec.rb#L876)
434
- * [calls the success callback of the Deferrable](./spec/acceptance/realtime/connection_spec.rb#L883)
591
+ * [calls the block with true](./spec/acceptance/realtime/connection_spec.rb#L1105)
592
+ * [calls the success callback of the Deferrable](./spec/acceptance/realtime/connection_spec.rb#L1112)
435
593
  * with a TLS connection
436
- * [checks the Internet up URL over TLS](./spec/acceptance/realtime/connection_spec.rb#L859)
594
+ * [checks the Internet up URL over TLS](./spec/acceptance/realtime/connection_spec.rb#L1088)
437
595
  * with a non-TLS connection
438
- * [checks the Internet up URL over TLS](./spec/acceptance/realtime/connection_spec.rb#L869)
596
+ * [checks the Internet up URL over TLS](./spec/acceptance/realtime/connection_spec.rb#L1098)
439
597
  * when the Internet is down
440
- * [calls the block with false](./spec/acceptance/realtime/connection_spec.rb#L898)
441
- * [calls the failure callback of the Deferrable](./spec/acceptance/realtime/connection_spec.rb#L905)
598
+ * [calls the block with false](./spec/acceptance/realtime/connection_spec.rb#L1127)
599
+ * [calls the failure callback of the Deferrable](./spec/acceptance/realtime/connection_spec.rb#L1134)
442
600
  * state change side effects
443
601
  * when connection enters the :disconnected state
444
- * [queues messages to be sent and all channels remain attached](./spec/acceptance/realtime/connection_spec.rb#L919)
602
+ * [queues messages to be sent and all channels remain attached](./spec/acceptance/realtime/connection_spec.rb#L1148)
445
603
  * when connection enters the :suspended state
446
- * [detaches the channels and prevents publishing of messages on those channels](./spec/acceptance/realtime/connection_spec.rb#L952)
604
+ * [detaches the channels and prevents publishing of messages on those channels](./spec/acceptance/realtime/connection_spec.rb#L1181)
447
605
  * when connection enters the :failed state
448
- * [sets all channels to failed and prevents publishing of messages on those channels](./spec/acceptance/realtime/connection_spec.rb#L973)
606
+ * [sets all channels to failed and prevents publishing of messages on those channels](./spec/acceptance/realtime/connection_spec.rb#L1210)
607
+ * connection state change
608
+ * [emits a ConnectionStateChange object](./spec/acceptance/realtime/connection_spec.rb#L1221)
609
+ * ConnectionStateChange object
610
+ * [has current state](./spec/acceptance/realtime/connection_spec.rb#L1229)
611
+ * [has a previous state](./spec/acceptance/realtime/connection_spec.rb#L1236)
612
+ * [has an empty reason when there is no error](./spec/acceptance/realtime/connection_spec.rb#L1251)
613
+ * on failure
614
+ * [has a reason Error object when there is an error on the connection](./spec/acceptance/realtime/connection_spec.rb#L1264)
615
+ * retry_in
616
+ * [is nil when a retry is not required](./spec/acceptance/realtime/connection_spec.rb#L1279)
617
+ * [is 0 when first attempt to connect fails](./spec/acceptance/realtime/connection_spec.rb#L1286)
618
+ * [is 0 when an immediate reconnect will occur](./spec/acceptance/realtime/connection_spec.rb#L1296)
619
+ * [contains the next retry period when an immediate reconnect will not occur](./spec/acceptance/realtime/connection_spec.rb#L1306)
449
620
 
450
621
  ### Ably::Realtime::Channel Message
451
622
  _(see [spec/acceptance/realtime/message_spec.rb](./spec/acceptance/realtime/message_spec.rb))_
452
- * using JSON and MsgPack protocol
623
+ * using JSON protocol
453
624
  * [sends a String data payload](./spec/acceptance/realtime/message_spec.rb#L25)
454
625
  * with supported data payload content type
455
626
  * JSON Object (Hash)
@@ -472,444 +643,540 @@ _(see [spec/acceptance/realtime/message_spec.rb](./spec/acceptance/realtime/mess
472
643
  * with ASCII_8BIT message name
473
644
  * [is converted into UTF_8](./spec/acceptance/realtime/message_spec.rb#L118)
474
645
  * when the message publisher has a client_id
475
- * PENDING: *[contains a #client_id attribute](./spec/acceptance/realtime/message_spec.rb#L134)*
646
+ * [contains a #client_id attribute](./spec/acceptance/realtime/message_spec.rb#L134)
476
647
  * #connection_id attribute
477
648
  * over realtime
478
- * [matches the sender connection#id](./spec/acceptance/realtime/message_spec.rb#L148)
649
+ * [matches the sender connection#id](./spec/acceptance/realtime/message_spec.rb#L147)
479
650
  * when retrieved over REST
480
- * [matches the sender connection#id](./spec/acceptance/realtime/message_spec.rb#L160)
651
+ * [matches the sender connection#id](./spec/acceptance/realtime/message_spec.rb#L159)
481
652
  * local echo when published
482
- * [is enabled by default](./spec/acceptance/realtime/message_spec.rb#L172)
653
+ * [is enabled by default](./spec/acceptance/realtime/message_spec.rb#L171)
483
654
  * with :echo_messages option set to false
484
- * [will not echo messages to the client but will still broadcast messages to other connected clients](./spec/acceptance/realtime/message_spec.rb#L188)
655
+ * [will not echo messages to the client but will still broadcast messages to other connected clients](./spec/acceptance/realtime/message_spec.rb#L191)
656
+ * [will not echo messages to the client from other REST clients publishing using that connection_key](./spec/acceptance/realtime/message_spec.rb#L210)
657
+ * [will echo messages with a valid connection_id to the client from other REST clients publishing using that connection_key](./spec/acceptance/realtime/message_spec.rb#L223)
485
658
  * publishing lots of messages across two connections
486
- * [sends and receives the messages on both opened connections and calls the success callbacks for each message published](./spec/acceptance/realtime/message_spec.rb#L220)
659
+ * [sends and receives the messages on both opened connections and calls the success callbacks for each message published](./spec/acceptance/realtime/message_spec.rb#L249)
487
660
  * without suitable publishing permissions
488
- * [calls the error callback](./spec/acceptance/realtime/message_spec.rb#L265)
661
+ * [calls the error callback](./spec/acceptance/realtime/message_spec.rb#L294)
489
662
  * server incorrectly resends a message that was already received by the client library
490
- * [discards the message and logs it as an error to the channel](./spec/acceptance/realtime/message_spec.rb#L285)
663
+ * [discards the message and logs it as an error to the channel](./spec/acceptance/realtime/message_spec.rb#L313)
491
664
  * encoding and decoding encrypted messages
492
665
  * with AES-128-CBC using crypto-data-128.json fixtures
493
666
  * item 0 with encrypted encoding utf-8/cipher+aes-128-cbc/base64
494
667
  * behaves like an Ably encrypter and decrypter
495
668
  * with #publish and #subscribe
496
- * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L349)
497
- * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L367)
669
+ * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L377)
670
+ * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L395)
498
671
  * item 1 with encrypted encoding cipher+aes-128-cbc/base64
499
672
  * behaves like an Ably encrypter and decrypter
500
673
  * with #publish and #subscribe
501
- * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L349)
502
- * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L367)
674
+ * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L377)
675
+ * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L395)
503
676
  * item 2 with encrypted encoding json/utf-8/cipher+aes-128-cbc/base64
504
677
  * behaves like an Ably encrypter and decrypter
505
678
  * with #publish and #subscribe
506
- * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L349)
507
- * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L367)
679
+ * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L377)
680
+ * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L395)
508
681
  * item 3 with encrypted encoding json/utf-8/cipher+aes-128-cbc/base64
509
682
  * behaves like an Ably encrypter and decrypter
510
683
  * with #publish and #subscribe
511
- * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L349)
512
- * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L367)
684
+ * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L377)
685
+ * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L395)
513
686
  * with AES-256-CBC using crypto-data-256.json fixtures
514
687
  * item 0 with encrypted encoding utf-8/cipher+aes-256-cbc/base64
515
688
  * behaves like an Ably encrypter and decrypter
516
689
  * with #publish and #subscribe
517
- * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L349)
518
- * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L367)
690
+ * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L377)
691
+ * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L395)
519
692
  * item 1 with encrypted encoding cipher+aes-256-cbc/base64
520
693
  * behaves like an Ably encrypter and decrypter
521
694
  * with #publish and #subscribe
522
- * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L349)
523
- * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L367)
695
+ * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L377)
696
+ * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L395)
524
697
  * item 2 with encrypted encoding json/utf-8/cipher+aes-256-cbc/base64
525
698
  * behaves like an Ably encrypter and decrypter
526
699
  * with #publish and #subscribe
527
- * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L349)
528
- * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L367)
700
+ * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L377)
701
+ * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L395)
529
702
  * item 3 with encrypted encoding json/utf-8/cipher+aes-256-cbc/base64
530
703
  * behaves like an Ably encrypter and decrypter
531
704
  * with #publish and #subscribe
532
- * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L349)
533
- * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L367)
705
+ * [encrypts message automatically before they are pushed to the server](./spec/acceptance/realtime/message_spec.rb#L377)
706
+ * [sends and receives messages that are encrypted & decrypted by the Ably library](./spec/acceptance/realtime/message_spec.rb#L395)
534
707
  * with multiple sends from one client to another
535
- * [encrypts and decrypts all messages](./spec/acceptance/realtime/message_spec.rb#L406)
708
+ * [encrypts and decrypts all messages](./spec/acceptance/realtime/message_spec.rb#L434)
709
+ * [receives raw messages with the correct encoding](./spec/acceptance/realtime/message_spec.rb#L451)
536
710
  * subscribing with a different transport protocol
537
- * [delivers a String ASCII-8BIT payload to the receiver](./spec/acceptance/realtime/message_spec.rb#L449)
538
- * [delivers a String UTF-8 payload to the receiver](./spec/acceptance/realtime/message_spec.rb#L449)
539
- * [delivers a Hash payload to the receiver](./spec/acceptance/realtime/message_spec.rb#L449)
711
+ * [delivers a String ASCII-8BIT payload to the receiver](./spec/acceptance/realtime/message_spec.rb#L485)
712
+ * [delivers a String UTF-8 payload to the receiver](./spec/acceptance/realtime/message_spec.rb#L485)
713
+ * [delivers a Hash payload to the receiver](./spec/acceptance/realtime/message_spec.rb#L485)
540
714
  * publishing on an unencrypted channel and subscribing on an encrypted channel with another client
541
- * [does not attempt to decrypt the message](./spec/acceptance/realtime/message_spec.rb#L468)
715
+ * [does not attempt to decrypt the message](./spec/acceptance/realtime/message_spec.rb#L504)
542
716
  * publishing on an encrypted channel and subscribing on an unencrypted channel with another client
543
- * [delivers the message but still encrypted with a value in the #encoding attribute](./spec/acceptance/realtime/message_spec.rb#L486)
544
- * [emits a Cipher error on the channel](./spec/acceptance/realtime/message_spec.rb#L495)
717
+ * [delivers the message but still encrypted with a value in the #encoding attribute](./spec/acceptance/realtime/message_spec.rb#L522)
718
+ * [emits a Cipher error on the channel](./spec/acceptance/realtime/message_spec.rb#L531)
545
719
  * publishing on an encrypted channel and subscribing with a different algorithm on another client
546
- * [delivers the message but still encrypted with the cipher detials in the #encoding attribute](./spec/acceptance/realtime/message_spec.rb#L517)
547
- * [emits a Cipher error on the channel](./spec/acceptance/realtime/message_spec.rb#L526)
720
+ * [delivers the message but still encrypted with the cipher detials in the #encoding attribute](./spec/acceptance/realtime/message_spec.rb#L553)
721
+ * [emits a Cipher error on the channel](./spec/acceptance/realtime/message_spec.rb#L562)
548
722
  * publishing on an encrypted channel and subscribing with a different key on another client
549
- * [delivers the message but still encrypted with the cipher details in the #encoding attribute](./spec/acceptance/realtime/message_spec.rb#L548)
550
- * [emits a Cipher error on the channel](./spec/acceptance/realtime/message_spec.rb#L559)
723
+ * [delivers the message but still encrypted with the cipher details in the #encoding attribute](./spec/acceptance/realtime/message_spec.rb#L584)
724
+ * [emits a Cipher error on the channel](./spec/acceptance/realtime/message_spec.rb#L595)
725
+ * when message is published, the connection disconnects before the ACK is received, and the connection is resumed
726
+ * [publishes the message again, later receives the ACK and only one message is ever received from Ably](./spec/acceptance/realtime/message_spec.rb#L616)
727
+ * when message is published, the connection disconnects before the ACK is received
728
+ * the connection is not resumed
729
+ * [calls the errback for all messages](./spec/acceptance/realtime/message_spec.rb#L659)
730
+ * the connection becomes suspended
731
+ * [calls the errback for all messages](./spec/acceptance/realtime/message_spec.rb#L685)
732
+ * the connection becomes failed
733
+ * [calls the errback for all messages](./spec/acceptance/realtime/message_spec.rb#L712)
551
734
 
552
735
  ### Ably::Realtime::Presence history
553
736
  _(see [spec/acceptance/realtime/presence_history_spec.rb](./spec/acceptance/realtime/presence_history_spec.rb))_
554
- * using JSON and MsgPack protocol
737
+ * using JSON protocol
555
738
  * [provides up to the moment presence history](./spec/acceptance/realtime/presence_history_spec.rb#L21)
556
739
  * [ensures REST presence history message IDs match ProtocolMessage wrapped message and connection IDs via Realtime](./spec/acceptance/realtime/presence_history_spec.rb#L42)
557
740
  * with option until_attach: true
558
741
  * [retrieves all presence messages before channel was attached](./spec/acceptance/realtime/presence_history_spec.rb#L61)
559
- * [raises an exception unless state is attached](./spec/acceptance/realtime/presence_history_spec.rb#L93)
742
+ * [raises an exception unless state is attached](./spec/acceptance/realtime/presence_history_spec.rb#L97)
560
743
  * and two pages of messages
561
- * [retrieves two pages of messages before channel was attached](./spec/acceptance/realtime/presence_history_spec.rb#L74)
744
+ * [retrieves two pages of messages before channel was attached](./spec/acceptance/realtime/presence_history_spec.rb#L78)
562
745
 
563
746
  ### Ably::Realtime::Presence
564
747
  _(see [spec/acceptance/realtime/presence_spec.rb](./spec/acceptance/realtime/presence_spec.rb))_
565
- * using JSON and MsgPack protocol
748
+ * using JSON protocol
566
749
  * when attached (but not present) on a presence channel with an anonymous client (no client ID)
567
- * [maintains state as other clients enter and leave the channel](./spec/acceptance/realtime/presence_spec.rb#L282)
750
+ * [maintains state as other clients enter and leave the channel](./spec/acceptance/realtime/presence_spec.rb#L412)
568
751
  * #sync_complete?
569
752
  * when attaching to a channel without any members present
570
- * [is true and the presence channel is considered synced immediately](./spec/acceptance/realtime/presence_spec.rb#L358)
753
+ * [is true and the presence channel is considered synced immediately](./spec/acceptance/realtime/presence_spec.rb#L488)
571
754
  * when attaching to a channel with members present
572
- * [is false and the presence channel will subsequently be synced](./spec/acceptance/realtime/presence_spec.rb#L367)
755
+ * [is false and the presence channel will subsequently be synced](./spec/acceptance/realtime/presence_spec.rb#L497)
573
756
  * 250 existing (present) members on a channel (3 SYNC pages)
574
757
  * requires at least 3 SYNC ProtocolMessages
575
758
  * when a client attaches to the presence channel
576
- * [emits :present for each member](./spec/acceptance/realtime/presence_spec.rb#L399)
759
+ * [emits :present for each member](./spec/acceptance/realtime/presence_spec.rb#L530)
577
760
  * and a member leaves before the SYNC operation is complete
578
- * [emits :leave immediately as the member leaves](./spec/acceptance/realtime/presence_spec.rb#L413)
579
- * [ignores presence events with timestamps prior to the current :present event in the MembersMap](./spec/acceptance/realtime/presence_spec.rb#L451)
580
- * [does not emit :present after the :leave event has been emitted, and that member is not included in the list of members via #get with :wait_for_sync](./spec/acceptance/realtime/presence_spec.rb#L490)
761
+ * [emits :leave immediately as the member leaves](./spec/acceptance/realtime/presence_spec.rb#L544)
762
+ * [ignores presence events with timestamps prior to the current :present event in the MembersMap](./spec/acceptance/realtime/presence_spec.rb#L585)
763
+ * [does not emit :present after the :leave event has been emitted, and that member is not included in the list of members via #get with :wait_for_sync](./spec/acceptance/realtime/presence_spec.rb#L627)
581
764
  * #get
582
765
  * with :wait_for_sync option set to true
583
- * [waits until sync is complete](./spec/acceptance/realtime/presence_spec.rb#L537)
766
+ * [waits until sync is complete](./spec/acceptance/realtime/presence_spec.rb#L677)
584
767
  * by default
585
- * [it does not wait for sync](./spec/acceptance/realtime/presence_spec.rb#L554)
768
+ * [it does not wait for sync](./spec/acceptance/realtime/presence_spec.rb#L694)
586
769
  * state
587
770
  * once opened
588
- * [once opened, enters the :left state if the channel detaches](./spec/acceptance/realtime/presence_spec.rb#L578)
771
+ * [once opened, enters the :left state if the channel detaches](./spec/acceptance/realtime/presence_spec.rb#L718)
589
772
  * #enter
590
- * [allows client_id to be set on enter for anonymous clients](./spec/acceptance/realtime/presence_spec.rb#L601)
591
- * [raises an exception if client_id is not set](./spec/acceptance/realtime/presence_spec.rb#L648)
773
+ * [allows client_id to be set on enter for anonymous clients](./spec/acceptance/realtime/presence_spec.rb#L741)
774
+ * [raises an exception if client_id is not set](./spec/acceptance/realtime/presence_spec.rb#L788)
592
775
  * data attribute
593
776
  * when provided as argument option to #enter
594
- * [remains intact following #leave](./spec/acceptance/realtime/presence_spec.rb#L612)
777
+ * [remains intact following #leave](./spec/acceptance/realtime/presence_spec.rb#L752)
595
778
  * message #connection_id
596
- * [matches the current client connection_id](./spec/acceptance/realtime/presence_spec.rb#L636)
779
+ * [matches the current client connection_id](./spec/acceptance/realtime/presence_spec.rb#L776)
597
780
  * without necessary capabilities to join presence
598
- * [calls the Deferrable errback on capabilities failure](./spec/acceptance/realtime/presence_spec.rb#L660)
781
+ * [calls the Deferrable errback on capabilities failure](./spec/acceptance/realtime/presence_spec.rb#L800)
599
782
  * it should behave like a public presence method
600
- * [raise an exception if the channel is detached](./spec/acceptance/realtime/presence_spec.rb#L44)
601
- * [raise an exception if the channel is failed](./spec/acceptance/realtime/presence_spec.rb#L44)
602
- * [implicitly attaches the channel](./spec/acceptance/realtime/presence_spec.rb#L55)
603
- * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L212)
604
- * [allows a block to be passed in that is executed upon success](./spec/acceptance/realtime/presence_spec.rb#L219)
605
- * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L227)
606
- * [catches exceptions in the provided method block and logs them to the logger](./spec/acceptance/realtime/presence_spec.rb#L237)
783
+ * [raise an exception if the channel is detached](./spec/acceptance/realtime/presence_spec.rb#L54)
784
+ * [raise an exception if the channel is failed](./spec/acceptance/realtime/presence_spec.rb#L66)
785
+ * [implicitly attaches the channel](./spec/acceptance/realtime/presence_spec.rb#L77)
786
+ * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L234)
787
+ * [allows a block to be passed in that is executed upon success](./spec/acceptance/realtime/presence_spec.rb#L241)
788
+ * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L249)
789
+ * [catches exceptions in the provided method block and logs them to the logger](./spec/acceptance/realtime/presence_spec.rb#L259)
607
790
  * when :queue_messages client option is false
608
791
  * and connection state initialized
609
- * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L67)
792
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L89)
610
793
  * and connection state connecting
611
- * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L75)
794
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L97)
612
795
  * and connection state disconnected
613
- * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L88)
796
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L110)
614
797
  * and connection state connected
615
- * [publishes the message](./spec/acceptance/realtime/presence_spec.rb#L101)
798
+ * [publishes the message](./spec/acceptance/realtime/presence_spec.rb#L123)
616
799
  * with supported data payload content type
617
800
  * JSON Object (Hash)
618
- * [is encoded and decoded to the same hash](./spec/acceptance/realtime/presence_spec.rb#L128)
801
+ * [is encoded and decoded to the same hash](./spec/acceptance/realtime/presence_spec.rb#L150)
619
802
  * JSON Array
620
- * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L138)
803
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L160)
621
804
  * String
622
- * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L148)
805
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L170)
623
806
  * Binary
624
- * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L158)
807
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L180)
625
808
  * with unsupported data payload content type
626
809
  * Integer
627
- * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L178)
810
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L200)
628
811
  * Float
629
- * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L187)
812
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L209)
630
813
  * Boolean
631
- * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L196)
814
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L218)
632
815
  * False
633
- * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L205)
816
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L227)
634
817
  * if connection fails before success
635
- * [calls the Deferrable errback if channel is detached](./spec/acceptance/realtime/presence_spec.rb#L258)
818
+ * [calls the Deferrable errback if channel is detached](./spec/acceptance/realtime/presence_spec.rb#L271)
636
819
  * #update
637
- * [without previous #enter automatically enters](./spec/acceptance/realtime/presence_spec.rb#L672)
638
- * [updates the data if :data argument provided](./spec/acceptance/realtime/presence_spec.rb#L697)
639
- * [updates the data to nil if :data argument is not provided (assumes nil value)](./spec/acceptance/realtime/presence_spec.rb#L707)
820
+ * [without previous #enter automatically enters](./spec/acceptance/realtime/presence_spec.rb#L812)
821
+ * [updates the data if :data argument provided](./spec/acceptance/realtime/presence_spec.rb#L837)
822
+ * [updates the data to nil if :data argument is not provided (assumes nil value)](./spec/acceptance/realtime/presence_spec.rb#L847)
640
823
  * when ENTERED
641
- * [has no effect on the state](./spec/acceptance/realtime/presence_spec.rb#L682)
824
+ * [has no effect on the state](./spec/acceptance/realtime/presence_spec.rb#L822)
642
825
  * it should behave like a public presence method
643
- * [raise an exception if the channel is detached](./spec/acceptance/realtime/presence_spec.rb#L44)
644
- * [raise an exception if the channel is failed](./spec/acceptance/realtime/presence_spec.rb#L44)
645
- * [implicitly attaches the channel](./spec/acceptance/realtime/presence_spec.rb#L55)
646
- * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L212)
647
- * [allows a block to be passed in that is executed upon success](./spec/acceptance/realtime/presence_spec.rb#L219)
648
- * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L227)
649
- * [catches exceptions in the provided method block and logs them to the logger](./spec/acceptance/realtime/presence_spec.rb#L237)
826
+ * [raise an exception if the channel is detached](./spec/acceptance/realtime/presence_spec.rb#L54)
827
+ * [raise an exception if the channel is failed](./spec/acceptance/realtime/presence_spec.rb#L66)
828
+ * [implicitly attaches the channel](./spec/acceptance/realtime/presence_spec.rb#L77)
829
+ * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L234)
830
+ * [allows a block to be passed in that is executed upon success](./spec/acceptance/realtime/presence_spec.rb#L241)
831
+ * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L249)
832
+ * [catches exceptions in the provided method block and logs them to the logger](./spec/acceptance/realtime/presence_spec.rb#L259)
650
833
  * when :queue_messages client option is false
651
834
  * and connection state initialized
652
- * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L67)
835
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L89)
653
836
  * and connection state connecting
654
- * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L75)
837
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L97)
655
838
  * and connection state disconnected
656
- * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L88)
839
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L110)
657
840
  * and connection state connected
658
- * [publishes the message](./spec/acceptance/realtime/presence_spec.rb#L101)
841
+ * [publishes the message](./spec/acceptance/realtime/presence_spec.rb#L123)
659
842
  * with supported data payload content type
660
843
  * JSON Object (Hash)
661
- * [is encoded and decoded to the same hash](./spec/acceptance/realtime/presence_spec.rb#L128)
844
+ * [is encoded and decoded to the same hash](./spec/acceptance/realtime/presence_spec.rb#L150)
662
845
  * JSON Array
663
- * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L138)
846
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L160)
664
847
  * String
665
- * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L148)
848
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L170)
666
849
  * Binary
667
- * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L158)
850
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L180)
668
851
  * with unsupported data payload content type
669
852
  * Integer
670
- * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L178)
853
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L200)
671
854
  * Float
672
- * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L187)
855
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L209)
673
856
  * Boolean
674
- * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L196)
857
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L218)
675
858
  * False
676
- * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L205)
859
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L227)
677
860
  * if connection fails before success
678
- * [calls the Deferrable errback if channel is detached](./spec/acceptance/realtime/presence_spec.rb#L258)
861
+ * [calls the Deferrable errback if channel is detached](./spec/acceptance/realtime/presence_spec.rb#L271)
679
862
  * #leave
680
- * [raises an exception if not entered](./spec/acceptance/realtime/presence_spec.rb#L781)
863
+ * [raises an exception if not entered](./spec/acceptance/realtime/presence_spec.rb#L921)
681
864
  * :data option
682
865
  * when set to a string
683
- * [emits the new data for the leave event](./spec/acceptance/realtime/presence_spec.rb#L726)
866
+ * [emits the new data for the leave event](./spec/acceptance/realtime/presence_spec.rb#L866)
684
867
  * when set to nil
685
- * [emits a nil value for the data attribute when leaving](./spec/acceptance/realtime/presence_spec.rb#L739)
868
+ * [emits a nil value for the data attribute when leaving](./spec/acceptance/realtime/presence_spec.rb#L879)
686
869
  * when not passed as an argument
687
- * [emits the previously defined value as a convenience](./spec/acceptance/realtime/presence_spec.rb#L752)
870
+ * [emits the previously defined value as a convenience](./spec/acceptance/realtime/presence_spec.rb#L892)
688
871
  * and sync is complete
689
- * [does not cache members that have left](./spec/acceptance/realtime/presence_spec.rb#L765)
872
+ * [does not cache members that have left](./spec/acceptance/realtime/presence_spec.rb#L905)
690
873
  * it should behave like a public presence method
691
- * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L212)
692
- * [allows a block to be passed in that is executed upon success](./spec/acceptance/realtime/presence_spec.rb#L219)
693
- * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L227)
694
- * [catches exceptions in the provided method block and logs them to the logger](./spec/acceptance/realtime/presence_spec.rb#L237)
874
+ * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L234)
875
+ * [allows a block to be passed in that is executed upon success](./spec/acceptance/realtime/presence_spec.rb#L241)
876
+ * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L249)
877
+ * [catches exceptions in the provided method block and logs them to the logger](./spec/acceptance/realtime/presence_spec.rb#L259)
695
878
  * with supported data payload content type
696
879
  * JSON Object (Hash)
697
- * [is encoded and decoded to the same hash](./spec/acceptance/realtime/presence_spec.rb#L128)
880
+ * [is encoded and decoded to the same hash](./spec/acceptance/realtime/presence_spec.rb#L150)
698
881
  * JSON Array
699
- * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L138)
882
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L160)
700
883
  * String
701
- * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L148)
884
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L170)
702
885
  * Binary
703
- * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L158)
886
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L180)
704
887
  * with unsupported data payload content type
705
888
  * Integer
706
- * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L178)
889
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L200)
707
890
  * Float
708
- * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L187)
891
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L209)
709
892
  * Boolean
710
- * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L196)
893
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L218)
711
894
  * False
712
- * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L205)
895
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L227)
713
896
  * if connection fails before success
714
- * [calls the Deferrable errback if channel is detached](./spec/acceptance/realtime/presence_spec.rb#L258)
897
+ * [calls the Deferrable errback if channel is detached](./spec/acceptance/realtime/presence_spec.rb#L271)
715
898
  * :left event
716
- * [emits the data defined in enter](./spec/acceptance/realtime/presence_spec.rb#L790)
717
- * [emits the data defined in update](./spec/acceptance/realtime/presence_spec.rb#L801)
899
+ * [emits the data defined in enter](./spec/acceptance/realtime/presence_spec.rb#L930)
900
+ * [emits the data defined in update](./spec/acceptance/realtime/presence_spec.rb#L941)
718
901
  * entering/updating/leaving presence state on behalf of another client_id
719
902
  * #enter_client
720
903
  * multiple times on the same channel with different client_ids
721
- * [has no affect on the client's presence state and only enters on behalf of the provided client_id](./spec/acceptance/realtime/presence_spec.rb#L822)
722
- * [enters a channel and sets the data based on the provided :data option](./spec/acceptance/realtime/presence_spec.rb#L836)
904
+ * [has no affect on the client's presence state and only enters on behalf of the provided client_id](./spec/acceptance/realtime/presence_spec.rb#L964)
905
+ * [enters a channel and sets the data based on the provided :data option](./spec/acceptance/realtime/presence_spec.rb#L978)
723
906
  * message #connection_id
724
- * [matches the current client connection_id](./spec/acceptance/realtime/presence_spec.rb#L855)
907
+ * [matches the current client connection_id](./spec/acceptance/realtime/presence_spec.rb#L997)
908
+ * without necessary capabilities to enter on behalf of another client
909
+ * [calls the Deferrable errback on capabilities failure](./spec/acceptance/realtime/presence_spec.rb#L1017)
725
910
  * it should behave like a public presence method
726
- * [raise an exception if the channel is detached](./spec/acceptance/realtime/presence_spec.rb#L44)
727
- * [raise an exception if the channel is failed](./spec/acceptance/realtime/presence_spec.rb#L44)
728
- * [implicitly attaches the channel](./spec/acceptance/realtime/presence_spec.rb#L55)
729
- * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L212)
730
- * [allows a block to be passed in that is executed upon success](./spec/acceptance/realtime/presence_spec.rb#L219)
731
- * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L227)
732
- * [catches exceptions in the provided method block and logs them to the logger](./spec/acceptance/realtime/presence_spec.rb#L237)
911
+ * [raise an exception if the channel is detached](./spec/acceptance/realtime/presence_spec.rb#L54)
912
+ * [raise an exception if the channel is failed](./spec/acceptance/realtime/presence_spec.rb#L66)
913
+ * [implicitly attaches the channel](./spec/acceptance/realtime/presence_spec.rb#L77)
914
+ * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L234)
915
+ * [allows a block to be passed in that is executed upon success](./spec/acceptance/realtime/presence_spec.rb#L241)
916
+ * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L249)
917
+ * [catches exceptions in the provided method block and logs them to the logger](./spec/acceptance/realtime/presence_spec.rb#L259)
733
918
  * when :queue_messages client option is false
734
919
  * and connection state initialized
735
- * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L67)
920
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L89)
736
921
  * and connection state connecting
737
- * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L75)
922
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L97)
738
923
  * and connection state disconnected
739
- * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L88)
924
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L110)
740
925
  * and connection state connected
741
- * [publishes the message](./spec/acceptance/realtime/presence_spec.rb#L101)
926
+ * [publishes the message](./spec/acceptance/realtime/presence_spec.rb#L123)
742
927
  * with supported data payload content type
743
928
  * JSON Object (Hash)
744
- * [is encoded and decoded to the same hash](./spec/acceptance/realtime/presence_spec.rb#L128)
929
+ * [is encoded and decoded to the same hash](./spec/acceptance/realtime/presence_spec.rb#L150)
745
930
  * JSON Array
746
- * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L138)
931
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L160)
747
932
  * String
748
- * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L148)
933
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L170)
749
934
  * Binary
750
- * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L158)
935
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L180)
751
936
  * with unsupported data payload content type
752
937
  * Integer
753
- * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L178)
938
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L200)
754
939
  * Float
755
- * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L187)
940
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L209)
756
941
  * Boolean
757
- * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L196)
942
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L218)
758
943
  * False
759
- * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L205)
944
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L227)
760
945
  * if connection fails before success
761
- * [calls the Deferrable errback if channel is detached](./spec/acceptance/realtime/presence_spec.rb#L258)
762
- * without necessary capabilities to enter on behalf of another client
763
- * [calls the Deferrable errback on capabilities failure](./spec/acceptance/realtime/presence_spec.rb#L877)
946
+ * [calls the Deferrable errback if channel is detached](./spec/acceptance/realtime/presence_spec.rb#L271)
947
+ * it should behave like a presence on behalf of another client method
948
+ * :enter_client when authenticated with a wildcard client_id
949
+ * and a valid client_id
950
+ * [succeeds](./spec/acceptance/realtime/presence_spec.rb#L302)
951
+ * and a wildcard client_id
952
+ * [throws an exception](./spec/acceptance/realtime/presence_spec.rb#L312)
953
+ * and an empty client_id
954
+ * [throws an exception](./spec/acceptance/realtime/presence_spec.rb#L319)
955
+ * :enter_client when authenticated with a valid client_id
956
+ * and another invalid client_id
957
+ * before authentication
958
+ * [allows the operation and then Ably rejects the operation](./spec/acceptance/realtime/presence_spec.rb#L335)
959
+ * after authentication
960
+ * [throws an exception](./spec/acceptance/realtime/presence_spec.rb#L344)
961
+ * and a wildcard client_id
962
+ * [throws an exception](./spec/acceptance/realtime/presence_spec.rb#L354)
963
+ * and an empty client_id
964
+ * [throws an exception](./spec/acceptance/realtime/presence_spec.rb#L361)
965
+ * :enter_client when anonymous and no client_id
966
+ * and another invalid client_id
967
+ * before authentication
968
+ * [allows the operation and then Ably rejects the operation](./spec/acceptance/realtime/presence_spec.rb#L377)
969
+ * after authentication
970
+ * [throws an exception](./spec/acceptance/realtime/presence_spec.rb#L386)
971
+ * and a wildcard client_id
972
+ * [throws an exception](./spec/acceptance/realtime/presence_spec.rb#L396)
973
+ * and an empty client_id
974
+ * [throws an exception](./spec/acceptance/realtime/presence_spec.rb#L403)
764
975
  * #update_client
765
976
  * multiple times on the same channel with different client_ids
766
- * [updates the data attribute for the member when :data option provided](./spec/acceptance/realtime/presence_spec.rb#L888)
767
- * [updates the data attribute to null for the member when :data option is not provided (assumed null)](./spec/acceptance/realtime/presence_spec.rb#L912)
768
- * [enters if not already entered](./spec/acceptance/realtime/presence_spec.rb#L924)
977
+ * [updates the data attribute for the member when :data option provided](./spec/acceptance/realtime/presence_spec.rb#L1031)
978
+ * [updates the data attribute to null for the member when :data option is not provided (assumed null)](./spec/acceptance/realtime/presence_spec.rb#L1055)
979
+ * [enters if not already entered](./spec/acceptance/realtime/presence_spec.rb#L1067)
769
980
  * it should behave like a public presence method
770
- * [raise an exception if the channel is detached](./spec/acceptance/realtime/presence_spec.rb#L44)
771
- * [raise an exception if the channel is failed](./spec/acceptance/realtime/presence_spec.rb#L44)
772
- * [implicitly attaches the channel](./spec/acceptance/realtime/presence_spec.rb#L55)
773
- * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L212)
774
- * [allows a block to be passed in that is executed upon success](./spec/acceptance/realtime/presence_spec.rb#L219)
775
- * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L227)
776
- * [catches exceptions in the provided method block and logs them to the logger](./spec/acceptance/realtime/presence_spec.rb#L237)
981
+ * [raise an exception if the channel is detached](./spec/acceptance/realtime/presence_spec.rb#L54)
982
+ * [raise an exception if the channel is failed](./spec/acceptance/realtime/presence_spec.rb#L66)
983
+ * [implicitly attaches the channel](./spec/acceptance/realtime/presence_spec.rb#L77)
984
+ * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L234)
985
+ * [allows a block to be passed in that is executed upon success](./spec/acceptance/realtime/presence_spec.rb#L241)
986
+ * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L249)
987
+ * [catches exceptions in the provided method block and logs them to the logger](./spec/acceptance/realtime/presence_spec.rb#L259)
777
988
  * when :queue_messages client option is false
778
989
  * and connection state initialized
779
- * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L67)
990
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L89)
780
991
  * and connection state connecting
781
- * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L75)
992
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L97)
782
993
  * and connection state disconnected
783
- * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L88)
994
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L110)
784
995
  * and connection state connected
785
- * [publishes the message](./spec/acceptance/realtime/presence_spec.rb#L101)
996
+ * [publishes the message](./spec/acceptance/realtime/presence_spec.rb#L123)
786
997
  * with supported data payload content type
787
998
  * JSON Object (Hash)
788
- * [is encoded and decoded to the same hash](./spec/acceptance/realtime/presence_spec.rb#L128)
999
+ * [is encoded and decoded to the same hash](./spec/acceptance/realtime/presence_spec.rb#L150)
789
1000
  * JSON Array
790
- * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L138)
1001
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L160)
791
1002
  * String
792
- * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L148)
1003
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L170)
793
1004
  * Binary
794
- * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L158)
1005
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L180)
795
1006
  * with unsupported data payload content type
796
1007
  * Integer
797
- * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L178)
1008
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L200)
798
1009
  * Float
799
- * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L187)
1010
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L209)
800
1011
  * Boolean
801
- * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L196)
1012
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L218)
802
1013
  * False
803
- * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L205)
1014
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L227)
804
1015
  * if connection fails before success
805
- * [calls the Deferrable errback if channel is detached](./spec/acceptance/realtime/presence_spec.rb#L258)
1016
+ * [calls the Deferrable errback if channel is detached](./spec/acceptance/realtime/presence_spec.rb#L271)
1017
+ * it should behave like a presence on behalf of another client method
1018
+ * :update_client when authenticated with a wildcard client_id
1019
+ * and a valid client_id
1020
+ * [succeeds](./spec/acceptance/realtime/presence_spec.rb#L302)
1021
+ * and a wildcard client_id
1022
+ * [throws an exception](./spec/acceptance/realtime/presence_spec.rb#L312)
1023
+ * and an empty client_id
1024
+ * [throws an exception](./spec/acceptance/realtime/presence_spec.rb#L319)
1025
+ * :update_client when authenticated with a valid client_id
1026
+ * and another invalid client_id
1027
+ * before authentication
1028
+ * [allows the operation and then Ably rejects the operation](./spec/acceptance/realtime/presence_spec.rb#L335)
1029
+ * after authentication
1030
+ * [throws an exception](./spec/acceptance/realtime/presence_spec.rb#L344)
1031
+ * and a wildcard client_id
1032
+ * [throws an exception](./spec/acceptance/realtime/presence_spec.rb#L354)
1033
+ * and an empty client_id
1034
+ * [throws an exception](./spec/acceptance/realtime/presence_spec.rb#L361)
1035
+ * :update_client when anonymous and no client_id
1036
+ * and another invalid client_id
1037
+ * before authentication
1038
+ * [allows the operation and then Ably rejects the operation](./spec/acceptance/realtime/presence_spec.rb#L377)
1039
+ * after authentication
1040
+ * [throws an exception](./spec/acceptance/realtime/presence_spec.rb#L386)
1041
+ * and a wildcard client_id
1042
+ * [throws an exception](./spec/acceptance/realtime/presence_spec.rb#L396)
1043
+ * and an empty client_id
1044
+ * [throws an exception](./spec/acceptance/realtime/presence_spec.rb#L403)
806
1045
  * #leave_client
807
1046
  * leaves a channel
808
1047
  * multiple times on the same channel with different client_ids
809
- * [emits the :leave event for each client_id](./spec/acceptance/realtime/presence_spec.rb#L953)
810
- * [succeeds if that client_id has not previously entered the channel](./spec/acceptance/realtime/presence_spec.rb#L977)
1048
+ * [emits the :leave event for each client_id](./spec/acceptance/realtime/presence_spec.rb#L1097)
1049
+ * [succeeds if that client_id has not previously entered the channel](./spec/acceptance/realtime/presence_spec.rb#L1121)
811
1050
  * with a new value in :data option
812
- * [emits the leave event with the new data value](./spec/acceptance/realtime/presence_spec.rb#L1001)
1051
+ * [emits the leave event with the new data value](./spec/acceptance/realtime/presence_spec.rb#L1145)
813
1052
  * with a nil value in :data option
814
- * [emits the leave event with the previous value as a convenience](./spec/acceptance/realtime/presence_spec.rb#L1014)
1053
+ * [emits the leave event with the previous value as a convenience](./spec/acceptance/realtime/presence_spec.rb#L1158)
815
1054
  * with no :data option
816
- * [emits the leave event with the previous value as a convenience](./spec/acceptance/realtime/presence_spec.rb#L1027)
1055
+ * [emits the leave event with the previous value as a convenience](./spec/acceptance/realtime/presence_spec.rb#L1171)
817
1056
  * it should behave like a public presence method
818
- * [raise an exception if the channel is detached](./spec/acceptance/realtime/presence_spec.rb#L44)
819
- * [raise an exception if the channel is failed](./spec/acceptance/realtime/presence_spec.rb#L44)
820
- * [implicitly attaches the channel](./spec/acceptance/realtime/presence_spec.rb#L55)
821
- * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L212)
822
- * [allows a block to be passed in that is executed upon success](./spec/acceptance/realtime/presence_spec.rb#L219)
823
- * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L227)
824
- * [catches exceptions in the provided method block and logs them to the logger](./spec/acceptance/realtime/presence_spec.rb#L237)
1057
+ * [raise an exception if the channel is detached](./spec/acceptance/realtime/presence_spec.rb#L54)
1058
+ * [raise an exception if the channel is failed](./spec/acceptance/realtime/presence_spec.rb#L66)
1059
+ * [implicitly attaches the channel](./spec/acceptance/realtime/presence_spec.rb#L77)
1060
+ * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L234)
1061
+ * [allows a block to be passed in that is executed upon success](./spec/acceptance/realtime/presence_spec.rb#L241)
1062
+ * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L249)
1063
+ * [catches exceptions in the provided method block and logs them to the logger](./spec/acceptance/realtime/presence_spec.rb#L259)
825
1064
  * when :queue_messages client option is false
826
1065
  * and connection state initialized
827
- * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L67)
1066
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L89)
828
1067
  * and connection state connecting
829
- * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L75)
1068
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L97)
830
1069
  * and connection state disconnected
831
- * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L88)
1070
+ * [raises an exception](./spec/acceptance/realtime/presence_spec.rb#L110)
832
1071
  * and connection state connected
833
- * [publishes the message](./spec/acceptance/realtime/presence_spec.rb#L101)
1072
+ * [publishes the message](./spec/acceptance/realtime/presence_spec.rb#L123)
834
1073
  * with supported data payload content type
835
1074
  * JSON Object (Hash)
836
- * [is encoded and decoded to the same hash](./spec/acceptance/realtime/presence_spec.rb#L128)
1075
+ * [is encoded and decoded to the same hash](./spec/acceptance/realtime/presence_spec.rb#L150)
837
1076
  * JSON Array
838
- * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L138)
1077
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L160)
839
1078
  * String
840
- * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L148)
1079
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L170)
841
1080
  * Binary
842
- * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L158)
1081
+ * [is encoded and decoded to the same Array](./spec/acceptance/realtime/presence_spec.rb#L180)
843
1082
  * with unsupported data payload content type
844
1083
  * Integer
845
- * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L178)
1084
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L200)
846
1085
  * Float
847
- * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L187)
1086
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L209)
848
1087
  * Boolean
849
- * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L196)
1088
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L218)
850
1089
  * False
851
- * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L205)
1090
+ * [raises an UnsupportedDataType 40011 exception](./spec/acceptance/realtime/presence_spec.rb#L227)
852
1091
  * if connection fails before success
853
- * [calls the Deferrable errback if channel is detached](./spec/acceptance/realtime/presence_spec.rb#L258)
1092
+ * [calls the Deferrable errback if channel is detached](./spec/acceptance/realtime/presence_spec.rb#L271)
1093
+ * it should behave like a presence on behalf of another client method
1094
+ * :leave_client when authenticated with a wildcard client_id
1095
+ * and a valid client_id
1096
+ * [succeeds](./spec/acceptance/realtime/presence_spec.rb#L302)
1097
+ * and a wildcard client_id
1098
+ * [throws an exception](./spec/acceptance/realtime/presence_spec.rb#L312)
1099
+ * and an empty client_id
1100
+ * [throws an exception](./spec/acceptance/realtime/presence_spec.rb#L319)
1101
+ * :leave_client when authenticated with a valid client_id
1102
+ * and another invalid client_id
1103
+ * before authentication
1104
+ * [allows the operation and then Ably rejects the operation](./spec/acceptance/realtime/presence_spec.rb#L335)
1105
+ * after authentication
1106
+ * [throws an exception](./spec/acceptance/realtime/presence_spec.rb#L344)
1107
+ * and a wildcard client_id
1108
+ * [throws an exception](./spec/acceptance/realtime/presence_spec.rb#L354)
1109
+ * and an empty client_id
1110
+ * [throws an exception](./spec/acceptance/realtime/presence_spec.rb#L361)
1111
+ * :leave_client when anonymous and no client_id
1112
+ * and another invalid client_id
1113
+ * before authentication
1114
+ * [allows the operation and then Ably rejects the operation](./spec/acceptance/realtime/presence_spec.rb#L377)
1115
+ * after authentication
1116
+ * [throws an exception](./spec/acceptance/realtime/presence_spec.rb#L386)
1117
+ * and a wildcard client_id
1118
+ * [throws an exception](./spec/acceptance/realtime/presence_spec.rb#L396)
1119
+ * and an empty client_id
1120
+ * [throws an exception](./spec/acceptance/realtime/presence_spec.rb#L403)
854
1121
  * #get
855
- * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L1045)
856
- * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L1050)
857
- * [catches exceptions in the provided method block](./spec/acceptance/realtime/presence_spec.rb#L1057)
858
- * [raise an exception if the channel is detached](./spec/acceptance/realtime/presence_spec.rb#L1065)
859
- * [raise an exception if the channel is failed](./spec/acceptance/realtime/presence_spec.rb#L1065)
860
- * [returns the current members on the channel](./spec/acceptance/realtime/presence_spec.rb#L1142)
861
- * [filters by connection_id option if provided](./spec/acceptance/realtime/presence_spec.rb#L1157)
862
- * [filters by client_id option if provided](./spec/acceptance/realtime/presence_spec.rb#L1179)
863
- * [does not wait for SYNC to complete if :wait_for_sync option is false](./spec/acceptance/realtime/presence_spec.rb#L1203)
1122
+ * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/presence_spec.rb#L1190)
1123
+ * [calls the Deferrable callback on success](./spec/acceptance/realtime/presence_spec.rb#L1195)
1124
+ * [catches exceptions in the provided method block](./spec/acceptance/realtime/presence_spec.rb#L1202)
1125
+ * [raise an exception if the channel is detached](./spec/acceptance/realtime/presence_spec.rb#L1209)
1126
+ * [raise an exception if the channel is failed](./spec/acceptance/realtime/presence_spec.rb#L1219)
1127
+ * [returns the current members on the channel](./spec/acceptance/realtime/presence_spec.rb#L1291)
1128
+ * [filters by connection_id option if provided](./spec/acceptance/realtime/presence_spec.rb#L1306)
1129
+ * [filters by client_id option if provided](./spec/acceptance/realtime/presence_spec.rb#L1328)
1130
+ * [does not wait for SYNC to complete if :wait_for_sync option is false](./spec/acceptance/realtime/presence_spec.rb#L1352)
864
1131
  * during a sync
865
1132
  * when :wait_for_sync is true
866
- * [fails if the connection fails](./spec/acceptance/realtime/presence_spec.rb#L1096)
867
- * [fails if the channel is detached](./spec/acceptance/realtime/presence_spec.rb#L1116)
1133
+ * [fails if the connection fails](./spec/acceptance/realtime/presence_spec.rb#L1242)
1134
+ * [fails if the channel is detached](./spec/acceptance/realtime/presence_spec.rb#L1265)
868
1135
  * when a member enters and then leaves
869
- * [has no members](./spec/acceptance/realtime/presence_spec.rb#L1213)
1136
+ * [has no members](./spec/acceptance/realtime/presence_spec.rb#L1362)
870
1137
  * with lots of members on different clients
871
- * [returns a complete list of members on all clients](./spec/acceptance/realtime/presence_spec.rb#L1230)
1138
+ * [returns a complete list of members on all clients](./spec/acceptance/realtime/presence_spec.rb#L1381)
872
1139
  * #subscribe
873
- * [implicitly attaches](./spec/acceptance/realtime/presence_spec.rb#L1305)
1140
+ * [implicitly attaches](./spec/acceptance/realtime/presence_spec.rb#L1456)
874
1141
  * with no arguments
875
- * [calls the callback for all presence events](./spec/acceptance/realtime/presence_spec.rb#L1266)
1142
+ * [calls the callback for all presence events](./spec/acceptance/realtime/presence_spec.rb#L1417)
876
1143
  * with event name
877
- * [calls the callback for specified presence event](./spec/acceptance/realtime/presence_spec.rb#L1286)
1144
+ * [calls the callback for specified presence event](./spec/acceptance/realtime/presence_spec.rb#L1437)
878
1145
  * #unsubscribe
879
1146
  * with no arguments
880
- * [removes the callback for all presence events](./spec/acceptance/realtime/presence_spec.rb#L1318)
1147
+ * [removes the callback for all presence events](./spec/acceptance/realtime/presence_spec.rb#L1469)
881
1148
  * with event name
882
- * [removes the callback for specified presence event](./spec/acceptance/realtime/presence_spec.rb#L1336)
1149
+ * [removes the callback for specified presence event](./spec/acceptance/realtime/presence_spec.rb#L1487)
883
1150
  * REST #get
884
- * [returns current members](./spec/acceptance/realtime/presence_spec.rb#L1355)
885
- * [returns no members once left](./spec/acceptance/realtime/presence_spec.rb#L1368)
1151
+ * [returns current members](./spec/acceptance/realtime/presence_spec.rb#L1506)
1152
+ * [returns no members once left](./spec/acceptance/realtime/presence_spec.rb#L1519)
886
1153
  * client_id with ASCII_8BIT
887
1154
  * in connection set up
888
- * [is converted into UTF_8](./spec/acceptance/realtime/presence_spec.rb#L1385)
1155
+ * [is converted into UTF_8](./spec/acceptance/realtime/presence_spec.rb#L1536)
889
1156
  * in channel options
890
- * [is converted into UTF_8](./spec/acceptance/realtime/presence_spec.rb#L1398)
1157
+ * [is converted into UTF_8](./spec/acceptance/realtime/presence_spec.rb#L1549)
891
1158
  * encoding and decoding of presence message data
892
- * [encrypts presence message data](./spec/acceptance/realtime/presence_spec.rb#L1422)
1159
+ * [encrypts presence message data](./spec/acceptance/realtime/presence_spec.rb#L1573)
893
1160
  * #subscribe
894
- * [emits decrypted enter events](./spec/acceptance/realtime/presence_spec.rb#L1441)
895
- * [emits decrypted update events](./spec/acceptance/realtime/presence_spec.rb#L1453)
896
- * [emits previously set data for leave events](./spec/acceptance/realtime/presence_spec.rb#L1467)
1161
+ * [emits decrypted enter events](./spec/acceptance/realtime/presence_spec.rb#L1592)
1162
+ * [emits decrypted update events](./spec/acceptance/realtime/presence_spec.rb#L1604)
1163
+ * [emits previously set data for leave events](./spec/acceptance/realtime/presence_spec.rb#L1618)
897
1164
  * #get
898
- * [returns a list of members with decrypted data](./spec/acceptance/realtime/presence_spec.rb#L1483)
1165
+ * [returns a list of members with decrypted data](./spec/acceptance/realtime/presence_spec.rb#L1634)
899
1166
  * REST #get
900
- * [returns a list of members with decrypted data](./spec/acceptance/realtime/presence_spec.rb#L1496)
1167
+ * [returns a list of members with decrypted data](./spec/acceptance/realtime/presence_spec.rb#L1647)
901
1168
  * when cipher settings do not match publisher
902
- * [delivers an unencoded presence message left with encoding value](./spec/acceptance/realtime/presence_spec.rb#L1511)
903
- * [emits an error when cipher does not match and presence data cannot be decoded](./spec/acceptance/realtime/presence_spec.rb#L1524)
1169
+ * [delivers an unencoded presence message left with encoding value](./spec/acceptance/realtime/presence_spec.rb#L1662)
1170
+ * [emits an error when cipher does not match and presence data cannot be decoded](./spec/acceptance/realtime/presence_spec.rb#L1675)
904
1171
  * leaving
905
- * [expect :left event once underlying connection is closed](./spec/acceptance/realtime/presence_spec.rb#L1541)
906
- * [expect :left event with client data from enter event](./spec/acceptance/realtime/presence_spec.rb#L1551)
1172
+ * [expect :left event once underlying connection is closed](./spec/acceptance/realtime/presence_spec.rb#L1692)
1173
+ * [expect :left event with client data from enter event](./spec/acceptance/realtime/presence_spec.rb#L1702)
907
1174
  * connection failure mid-way through a large member sync
908
- * [resumes the SYNC operation](./spec/acceptance/realtime/presence_spec.rb#L1569)
1175
+ * [resumes the SYNC operation](./spec/acceptance/realtime/presence_spec.rb#L1721)
909
1176
 
910
1177
  ### Ably::Realtime::Client#stats
911
1178
  _(see [spec/acceptance/realtime/stats_spec.rb](./spec/acceptance/realtime/stats_spec.rb))_
912
- * using JSON and MsgPack protocol
1179
+ * using JSON protocol
913
1180
  * fetching stats
914
1181
  * [returns a PaginatedResult](./spec/acceptance/realtime/stats_spec.rb#L10)
915
1182
  * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/stats_spec.rb#L29)
@@ -918,14 +1185,16 @@ _(see [spec/acceptance/realtime/stats_spec.rb](./spec/acceptance/realtime/stats_
918
1185
 
919
1186
  ### Ably::Realtime::Client#time
920
1187
  _(see [spec/acceptance/realtime/time_spec.rb](./spec/acceptance/realtime/time_spec.rb))_
921
- * using JSON and MsgPack protocol
1188
+ * using JSON protocol
922
1189
  * fetching the service time
923
1190
  * [should return the service time as a Time object](./spec/acceptance/realtime/time_spec.rb#L10)
924
1191
  * [returns a SafeDeferrable that catches exceptions in callbacks and logs them](./spec/acceptance/realtime/time_spec.rb#L19)
1192
+ * with reconfigured HTTP timeout
1193
+ * [should raise a timeout exception](./spec/acceptance/realtime/time_spec.rb#L31)
925
1194
 
926
1195
  ### Ably::Auth
927
1196
  _(see [spec/acceptance/rest/auth_spec.rb](./spec/acceptance/rest/auth_spec.rb))_
928
- * using JSON and MsgPack protocol
1197
+ * using JSON protocol
929
1198
  * [has immutable options](./spec/acceptance/rest/auth_spec.rb#L60)
930
1199
  * #request_token
931
1200
  * [creates a TokenRequest automatically and sends it to Ably to obtain a token](./spec/acceptance/rest/auth_spec.rb#L75)
@@ -948,110 +1217,158 @@ _(see [spec/acceptance/rest/auth_spec.rb](./spec/acceptance/rest/auth_spec.rb))_
948
1217
  * [queries the server for the time](./spec/acceptance/rest/auth_spec.rb#L185)
949
1218
  * without :query_time option
950
1219
  * [does not query the server for the time](./spec/acceptance/rest/auth_spec.rb#L194)
1220
+ * with :auth_url option merging
1221
+ * with existing configured auth options
1222
+ * using unspecified :auth_method
1223
+ * [requests a token using a GET request with provided headers, and merges client_id into auth_params](./spec/acceptance/rest/auth_spec.rb#L234)
1224
+ * with provided token_params
1225
+ * [merges provided token_params with existing auth_params and client_id](./spec/acceptance/rest/auth_spec.rb#L242)
1226
+ * with provided auth option auth_params and auth_headers
1227
+ * [replaces any preconfigured auth_params](./spec/acceptance/rest/auth_spec.rb#L250)
1228
+ * using :get :auth_method and query params in the URL
1229
+ * [requests a token using a GET request with provided headers, and merges client_id into auth_params and existing URL querystring into new URL querystring](./spec/acceptance/rest/auth_spec.rb#L261)
1230
+ * using :post :auth_method
1231
+ * [requests a token using a POST request with provided headers, and merges client_id into auth_params as form-encoded post data](./spec/acceptance/rest/auth_spec.rb#L271)
951
1232
  * with :auth_url option
952
1233
  * when response from :auth_url is a valid token request
953
- * [requests a token from :auth_url using an HTTP GET request](./spec/acceptance/rest/auth_spec.rb#L242)
954
- * [returns a valid token generated from the token request](./spec/acceptance/rest/auth_spec.rb#L247)
1234
+ * [requests a token from :auth_url using an HTTP GET request](./spec/acceptance/rest/auth_spec.rb#L321)
1235
+ * [returns a valid token generated from the token request](./spec/acceptance/rest/auth_spec.rb#L326)
955
1236
  * with :query_params
956
- * [requests a token from :auth_url with the :query_params](./spec/acceptance/rest/auth_spec.rb#L254)
1237
+ * [requests a token from :auth_url with the :query_params](./spec/acceptance/rest/auth_spec.rb#L333)
957
1238
  * with :headers
958
- * [requests a token from :auth_url with the HTTP headers set](./spec/acceptance/rest/auth_spec.rb#L262)
1239
+ * [requests a token from :auth_url with the HTTP headers set](./spec/acceptance/rest/auth_spec.rb#L341)
959
1240
  * with POST
960
- * [requests a token from :auth_url using an HTTP POST instead of the default GET](./spec/acceptance/rest/auth_spec.rb#L270)
1241
+ * [requests a token from :auth_url using an HTTP POST instead of the default GET](./spec/acceptance/rest/auth_spec.rb#L349)
961
1242
  * when response from :auth_url is a token details object
962
- * [returns TokenDetails created from the token JSON](./spec/acceptance/rest/auth_spec.rb#L295)
1243
+ * [returns TokenDetails created from the token JSON](./spec/acceptance/rest/auth_spec.rb#L374)
963
1244
  * when response from :auth_url is text/plain content type and a token string
964
- * [returns TokenDetails created from the token JSON](./spec/acceptance/rest/auth_spec.rb#L313)
1245
+ * [returns TokenDetails created from the token JSON](./spec/acceptance/rest/auth_spec.rb#L392)
965
1246
  * when response is invalid
966
1247
  * 500
967
- * [raises ServerError](./spec/acceptance/rest/auth_spec.rb#L327)
1248
+ * [raises ServerError](./spec/acceptance/rest/auth_spec.rb#L406)
968
1249
  * XML
969
- * [raises InvalidResponseBody](./spec/acceptance/rest/auth_spec.rb#L338)
1250
+ * [raises InvalidResponseBody](./spec/acceptance/rest/auth_spec.rb#L417)
970
1251
  * with a Proc for the :auth_callback option
971
1252
  * that returns a TokenRequest
972
- * [calls the Proc with token_params when authenticating to obtain the request token](./spec/acceptance/rest/auth_spec.rb#L361)
973
- * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L365)
1253
+ * [calls the Proc with token_params when authenticating to obtain the request token](./spec/acceptance/rest/auth_spec.rb#L440)
1254
+ * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L444)
1255
+ * when authorised
1256
+ * [sets Auth#client_id to the new token's client_id](./spec/acceptance/rest/auth_spec.rb#L451)
1257
+ * [sets Client#client_id to the new token's client_id](./spec/acceptance/rest/auth_spec.rb#L455)
974
1258
  * that returns a TokenDetails JSON object
975
- * [calls the Proc when authenticating to obtain the request token](./spec/acceptance/rest/auth_spec.rb#L394)
976
- * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L399)
1259
+ * [calls the Proc when authenticating to obtain the request token](./spec/acceptance/rest/auth_spec.rb#L489)
1260
+ * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L494)
1261
+ * when authorised
1262
+ * [sets Auth#client_id to the new token's client_id](./spec/acceptance/rest/auth_spec.rb#L506)
1263
+ * [sets Client#client_id to the new token's client_id](./spec/acceptance/rest/auth_spec.rb#L510)
977
1264
  * that returns a TokenDetails object
978
- * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L420)
1265
+ * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L525)
979
1266
  * that returns a Token string
980
- * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L436)
1267
+ * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L541)
981
1268
  * with auth_option :client_id
982
- * [returns a token with the client_id](./spec/acceptance/rest/auth_spec.rb#L467)
1269
+ * [returns a token with the client_id](./spec/acceptance/rest/auth_spec.rb#L571)
983
1270
  * with token_param :client_id
984
- * [returns a token with the client_id](./spec/acceptance/rest/auth_spec.rb#L476)
1271
+ * [returns a token with the client_id](./spec/acceptance/rest/auth_spec.rb#L580)
985
1272
  * before #authorise has been called
986
- * [has no current_token_details](./spec/acceptance/rest/auth_spec.rb#L483)
1273
+ * [has no current_token_details](./spec/acceptance/rest/auth_spec.rb#L587)
987
1274
  * #authorise
988
- * [updates the persisted auth options that are then used for subsequent authorise requests](./spec/acceptance/rest/auth_spec.rb#L533)
1275
+ * [updates the persisted token params that are then used for subsequent authorise requests](./spec/acceptance/rest/auth_spec.rb#L637)
1276
+ * [updates the persisted token params that are then used for subsequent authorise requests](./spec/acceptance/rest/auth_spec.rb#L643)
989
1277
  * when called for the first time since the client has been instantiated
990
- * [passes all auth_options and token_params to #request_token](./spec/acceptance/rest/auth_spec.rb#L497)
991
- * [returns a valid token](./spec/acceptance/rest/auth_spec.rb#L502)
992
- * [issues a new token if option :force => true](./spec/acceptance/rest/auth_spec.rb#L506)
1278
+ * [passes all auth_options and token_params to #request_token](./spec/acceptance/rest/auth_spec.rb#L601)
1279
+ * [returns a valid token](./spec/acceptance/rest/auth_spec.rb#L606)
1280
+ * [issues a new token if option :force => true](./spec/acceptance/rest/auth_spec.rb#L610)
993
1281
  * with previous authorisation
994
- * [does not request a token if current_token_details has not expired](./spec/acceptance/rest/auth_spec.rb#L517)
995
- * [requests a new token if token is expired](./spec/acceptance/rest/auth_spec.rb#L522)
996
- * [issues a new token if option :force => true](./spec/acceptance/rest/auth_spec.rb#L528)
1282
+ * [does not request a token if current_token_details has not expired](./spec/acceptance/rest/auth_spec.rb#L621)
1283
+ * [requests a new token if token is expired](./spec/acceptance/rest/auth_spec.rb#L626)
1284
+ * [issues a new token if option :force => true](./spec/acceptance/rest/auth_spec.rb#L632)
997
1285
  * with a Proc for the :auth_callback option
998
- * [calls the Proc](./spec/acceptance/rest/auth_spec.rb#L549)
999
- * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L553)
1286
+ * [calls the Proc](./spec/acceptance/rest/auth_spec.rb#L659)
1287
+ * [uses the token request returned from the callback when requesting a new token](./spec/acceptance/rest/auth_spec.rb#L663)
1000
1288
  * for every subsequent #request_token
1001
1289
  * without a :auth_callback Proc
1002
- * [calls the originally provided block](./spec/acceptance/rest/auth_spec.rb#L559)
1290
+ * [calls the originally provided block](./spec/acceptance/rest/auth_spec.rb#L669)
1003
1291
  * with a provided block
1004
- * [does not call the originally provided Proc and calls the new #request_token :auth_callback Proc](./spec/acceptance/rest/auth_spec.rb#L566)
1292
+ * [does not call the originally provided Proc and calls the new #request_token :auth_callback Proc](./spec/acceptance/rest/auth_spec.rb#L676)
1293
+ * with an explicit token string that expires
1294
+ * and a Proc for the :auth_callback option to provide a means to renew the token
1295
+ * [calls the Proc once the token has expired and the new token is used](./spec/acceptance/rest/auth_spec.rb#L703)
1296
+ * with an explicit ClientOptions client_id
1297
+ * and an incompatible client_id in a TokenDetails object passed to the auth callback
1298
+ * [rejects a TokenDetails object with an incompatible client_id and raises an exception](./spec/acceptance/rest/auth_spec.rb#L721)
1299
+ * and an incompatible client_id in a TokenRequest object passed to the auth callback and raises an exception
1300
+ * [rejects a TokenRequests object with an incompatible client_id and raises an exception](./spec/acceptance/rest/auth_spec.rb#L729)
1301
+ * and a token string without any retrievable client_id
1302
+ * [rejects a TokenRequests object with an incompatible client_id and raises an exception](./spec/acceptance/rest/auth_spec.rb#L737)
1005
1303
  * #create_token_request
1006
- * [returns a TokenRequest object](./spec/acceptance/rest/auth_spec.rb#L583)
1007
- * [returns a TokenRequest that can be passed to a client that can use it for authentication without an API key](./spec/acceptance/rest/auth_spec.rb#L587)
1008
- * [uses the key name from the client](./spec/acceptance/rest/auth_spec.rb#L594)
1009
- * [uses the default TTL](./spec/acceptance/rest/auth_spec.rb#L598)
1010
- * [uses the default capability](./spec/acceptance/rest/auth_spec.rb#L611)
1304
+ * [returns a TokenRequest object](./spec/acceptance/rest/auth_spec.rb#L752)
1305
+ * [returns a TokenRequest that can be passed to a client that can use it for authentication without an API key](./spec/acceptance/rest/auth_spec.rb#L756)
1306
+ * [uses the key name from the client](./spec/acceptance/rest/auth_spec.rb#L763)
1307
+ * [uses the default TTL](./spec/acceptance/rest/auth_spec.rb#L767)
1308
+ * [uses the default capability](./spec/acceptance/rest/auth_spec.rb#L780)
1011
1309
  * with a :ttl option below the Token expiry buffer that ensures tokens are renewed 15s before they expire as they are considered expired
1012
- * [uses the Token expiry buffer default + 10s to allow for a token request in flight](./spec/acceptance/rest/auth_spec.rb#L605)
1310
+ * [uses the Token expiry buffer default + 10s to allow for a token request in flight](./spec/acceptance/rest/auth_spec.rb#L774)
1013
1311
  * the nonce
1014
- * [is unique for every request](./spec/acceptance/rest/auth_spec.rb#L616)
1015
- * [is at least 16 characters](./spec/acceptance/rest/auth_spec.rb#L621)
1312
+ * [is unique for every request](./spec/acceptance/rest/auth_spec.rb#L785)
1313
+ * [is at least 16 characters](./spec/acceptance/rest/auth_spec.rb#L790)
1016
1314
  * with token param :ttl
1017
- * [overrides default](./spec/acceptance/rest/auth_spec.rb#L632)
1315
+ * [overrides default](./spec/acceptance/rest/auth_spec.rb#L801)
1018
1316
  * with token param :nonce
1019
- * [overrides default](./spec/acceptance/rest/auth_spec.rb#L632)
1317
+ * [overrides default](./spec/acceptance/rest/auth_spec.rb#L801)
1020
1318
  * with token param :client_id
1021
- * [overrides default](./spec/acceptance/rest/auth_spec.rb#L632)
1319
+ * [overrides default](./spec/acceptance/rest/auth_spec.rb#L801)
1022
1320
  * when specifying capability
1023
- * [overrides the default](./spec/acceptance/rest/auth_spec.rb#L643)
1024
- * [uses these capabilities when Ably issues an actual token](./spec/acceptance/rest/auth_spec.rb#L647)
1321
+ * [overrides the default](./spec/acceptance/rest/auth_spec.rb#L812)
1322
+ * [uses these capabilities when Ably issues an actual token](./spec/acceptance/rest/auth_spec.rb#L816)
1025
1323
  * with additional invalid attributes
1026
- * [are ignored](./spec/acceptance/rest/auth_spec.rb#L657)
1324
+ * [are ignored](./spec/acceptance/rest/auth_spec.rb#L826)
1027
1325
  * when required fields are missing
1028
- * [should raise an exception if key secret is missing](./spec/acceptance/rest/auth_spec.rb#L668)
1029
- * [should raise an exception if key name is missing](./spec/acceptance/rest/auth_spec.rb#L672)
1326
+ * [should raise an exception if key secret is missing](./spec/acceptance/rest/auth_spec.rb#L837)
1327
+ * [should raise an exception if key name is missing](./spec/acceptance/rest/auth_spec.rb#L841)
1030
1328
  * timestamp attribute
1031
- * [is a Time object in Ruby and is set to the local time](./spec/acceptance/rest/auth_spec.rb#L699)
1329
+ * [is a Time object in Ruby and is set to the local time](./spec/acceptance/rest/auth_spec.rb#L868)
1032
1330
  * with :query_time auth_option
1033
- * [queries the server for the timestamp](./spec/acceptance/rest/auth_spec.rb#L684)
1331
+ * [queries the server for the timestamp](./spec/acceptance/rest/auth_spec.rb#L853)
1034
1332
  * with :timestamp option
1035
- * [uses the provided timestamp in the token request](./spec/acceptance/rest/auth_spec.rb#L694)
1333
+ * [uses the provided timestamp in the token request](./spec/acceptance/rest/auth_spec.rb#L863)
1036
1334
  * signing
1037
- * [generates a valid HMAC](./spec/acceptance/rest/auth_spec.rb#L723)
1335
+ * [generates a valid HMAC](./spec/acceptance/rest/auth_spec.rb#L892)
1038
1336
  * using token authentication
1039
1337
  * with :token option
1040
- * [authenticates successfully using the provided :token](./spec/acceptance/rest/auth_spec.rb#L746)
1041
- * [disallows publishing on unspecified capability channels](./spec/acceptance/rest/auth_spec.rb#L750)
1042
- * [fails if timestamp is invalid](./spec/acceptance/rest/auth_spec.rb#L758)
1043
- * [cannot be renewed automatically](./spec/acceptance/rest/auth_spec.rb#L766)
1044
- * when implicit as a result of using :client id
1338
+ * [authenticates successfully using the provided :token](./spec/acceptance/rest/auth_spec.rb#L915)
1339
+ * [disallows publishing on unspecified capability channels](./spec/acceptance/rest/auth_spec.rb#L919)
1340
+ * [fails if timestamp is invalid](./spec/acceptance/rest/auth_spec.rb#L927)
1341
+ * [cannot be renewed automatically](./spec/acceptance/rest/auth_spec.rb#L935)
1342
+ * when implicit as a result of using :client_id
1045
1343
  * and requests to the Ably server are mocked
1046
- * [will send a token request to the server](./spec/acceptance/rest/auth_spec.rb#L794)
1344
+ * [will send a token request to the server](./spec/acceptance/rest/auth_spec.rb#L963)
1047
1345
  * a token is created
1048
- * [before a request is made](./spec/acceptance/rest/auth_spec.rb#L803)
1049
- * [when a message is published](./spec/acceptance/rest/auth_spec.rb#L807)
1050
- * [with capability and TTL defaults](./spec/acceptance/rest/auth_spec.rb#L811)
1051
- * when using an :key and basic auth
1052
- * [#using_token_auth? is false](./spec/acceptance/rest/auth_spec.rb#L826)
1053
- * [#key attribute contains the key string](./spec/acceptance/rest/auth_spec.rb#L830)
1054
- * [#using_basic_auth? is true](./spec/acceptance/rest/auth_spec.rb#L834)
1346
+ * [before a request is made](./spec/acceptance/rest/auth_spec.rb#L972)
1347
+ * [when a message is published](./spec/acceptance/rest/auth_spec.rb#L976)
1348
+ * [with capability and TTL defaults](./spec/acceptance/rest/auth_spec.rb#L980)
1349
+ * [#client_id contains the client_id](./spec/acceptance/rest/auth_spec.rb#L991)
1350
+ * when :client_id is provided in a token
1351
+ * [#client_id contains the client_id](./spec/acceptance/rest/auth_spec.rb#L1006)
1352
+ * #client_id_validated?
1353
+ * when using basic auth
1354
+ * [is false as basic auth users do not have an identity](./spec/acceptance/rest/auth_spec.rb#L1018)
1355
+ * when using a token auth string for a token with a client_id
1356
+ * [is false as identification is not possible from an opaque token string](./spec/acceptance/rest/auth_spec.rb#L1026)
1357
+ * when using a token
1358
+ * with a client_id
1359
+ * [is true](./spec/acceptance/rest/auth_spec.rb#L1035)
1360
+ * with no client_id (anonymous)
1361
+ * [is true](./spec/acceptance/rest/auth_spec.rb#L1043)
1362
+ * with a wildcard client_id (anonymous)
1363
+ * [is false](./spec/acceptance/rest/auth_spec.rb#L1051)
1364
+ * when using a token request with a client_id
1365
+ * [is not true as identification is not confirmed until authenticated](./spec/acceptance/rest/auth_spec.rb#L1060)
1366
+ * after authentication
1367
+ * [is true as identification is completed during implicit authentication](./spec/acceptance/rest/auth_spec.rb#L1067)
1368
+ * when using a :key and basic auth
1369
+ * [#using_token_auth? is false](./spec/acceptance/rest/auth_spec.rb#L1075)
1370
+ * [#key attribute contains the key string](./spec/acceptance/rest/auth_spec.rb#L1079)
1371
+ * [#using_basic_auth? is true](./spec/acceptance/rest/auth_spec.rb#L1083)
1055
1372
 
1056
1373
  ### Ably::Rest
1057
1374
  _(see [spec/acceptance/rest/base_spec.rb](./spec/acceptance/rest/base_spec.rb))_
@@ -1066,7 +1383,7 @@ _(see [spec/acceptance/rest/base_spec.rb](./spec/acceptance/rest/base_spec.rb))_
1066
1383
  * [uses MsgPack](./spec/acceptance/rest/base_spec.rb#L60)
1067
1384
  * when option {:use_binary_protocol=>true} is used
1068
1385
  * [uses MsgPack](./spec/acceptance/rest/base_spec.rb#L60)
1069
- * using JSON and MsgPack protocol
1386
+ * using JSON protocol
1070
1387
  * failed requests
1071
1388
  * due to invalid Auth
1072
1389
  * [should raise an InvalidRequest exception with a valid error message and code](./spec/acceptance/rest/base_spec.rb#L75)
@@ -1082,55 +1399,92 @@ _(see [spec/acceptance/rest/base_spec.rb](./spec/acceptance/rest/base_spec.rb))_
1082
1399
 
1083
1400
  ### Ably::Rest::Channel
1084
1401
  _(see [spec/acceptance/rest/channel_spec.rb](./spec/acceptance/rest/channel_spec.rb))_
1085
- * using JSON and MsgPack protocol
1402
+ * using JSON protocol
1086
1403
  * #publish
1087
1404
  * with name and data arguments
1088
- * [publishes the message and return true indicating success](./spec/acceptance/rest/channel_spec.rb#L20)
1405
+ * [publishes the message and return true indicating success](./spec/acceptance/rest/channel_spec.rb#L21)
1406
+ * and additional attributes
1407
+ * [publishes the message with the attributes and return true indicating success](./spec/acceptance/rest/channel_spec.rb#L30)
1408
+ * with a client_id configured in the ClientOptions
1409
+ * [publishes the message without a client_id](./spec/acceptance/rest/channel_spec.rb#L41)
1410
+ * [expects a client_id to be added by the realtime service](./spec/acceptance/rest/channel_spec.rb#L49)
1089
1411
  * with an array of Hash objects with :name and :data attributes
1090
- * [publishes an array of messages in one HTTP request](./spec/acceptance/rest/channel_spec.rb#L34)
1412
+ * [publishes an array of messages in one HTTP request](./spec/acceptance/rest/channel_spec.rb#L62)
1091
1413
  * with an array of Message objects
1092
- * [publishes an array of messages in one HTTP request](./spec/acceptance/rest/channel_spec.rb#L49)
1414
+ * [publishes an array of messages in one HTTP request](./spec/acceptance/rest/channel_spec.rb#L77)
1093
1415
  * without adequate permissions on the channel
1094
- * [raises a permission error when publishing](./spec/acceptance/rest/channel_spec.rb#L61)
1416
+ * [raises a permission error when publishing](./spec/acceptance/rest/channel_spec.rb#L89)
1095
1417
  * null attributes
1096
1418
  * when name is null
1097
- * [publishes the message without a name attribute in the payload](./spec/acceptance/rest/channel_spec.rb#L70)
1419
+ * [publishes the message without a name attribute in the payload](./spec/acceptance/rest/channel_spec.rb#L98)
1098
1420
  * when data is null
1099
- * [publishes the message without a data attribute in the payload](./spec/acceptance/rest/channel_spec.rb#L81)
1421
+ * [publishes the message without a data attribute in the payload](./spec/acceptance/rest/channel_spec.rb#L109)
1100
1422
  * with neither name or data attributes
1101
- * [publishes the message without any attributes in the payload](./spec/acceptance/rest/channel_spec.rb#L92)
1423
+ * [publishes the message without any attributes in the payload](./spec/acceptance/rest/channel_spec.rb#L120)
1424
+ * identified clients
1425
+ * when authenticated with a wildcard client_id
1426
+ * with a valid client_id in the message
1427
+ * [succeeds](./spec/acceptance/rest/channel_spec.rb#L137)
1428
+ * with a wildcard client_id in the message
1429
+ * [throws an exception](./spec/acceptance/rest/channel_spec.rb#L146)
1430
+ * with an empty client_id in the message
1431
+ * [succeeds and publishes without a client_id](./spec/acceptance/rest/channel_spec.rb#L152)
1432
+ * when authenticated with a Token string with an implicit client_id
1433
+ * without having a confirmed identity
1434
+ * with a valid client_id in the message
1435
+ * [succeeds](./spec/acceptance/rest/channel_spec.rb#L169)
1436
+ * with an invalid client_id in the message
1437
+ * [succeeds in the client library but then fails when published to Ably](./spec/acceptance/rest/channel_spec.rb#L178)
1438
+ * with an empty client_id in the message
1439
+ * [succeeds and publishes with an implicit client_id](./spec/acceptance/rest/channel_spec.rb#L184)
1440
+ * when authenticated with TokenDetails with a valid client_id
1441
+ * with a valid client_id in the message
1442
+ * [succeeds](./spec/acceptance/rest/channel_spec.rb#L201)
1443
+ * with a wildcard client_id in the message
1444
+ * [throws an exception](./spec/acceptance/rest/channel_spec.rb#L210)
1445
+ * with an invalid client_id in the message
1446
+ * [throws an exception](./spec/acceptance/rest/channel_spec.rb#L216)
1447
+ * with an empty client_id in the message
1448
+ * [succeeds and publishes with an implicit client_id](./spec/acceptance/rest/channel_spec.rb#L222)
1449
+ * when anonymous and no client_id
1450
+ * with a client_id in the message
1451
+ * [throws an exception](./spec/acceptance/rest/channel_spec.rb#L238)
1452
+ * with a wildcard client_id in the message
1453
+ * [throws an exception](./spec/acceptance/rest/channel_spec.rb#L244)
1454
+ * with an empty client_id in the message
1455
+ * [succeeds and publishes with an implicit client_id](./spec/acceptance/rest/channel_spec.rb#L250)
1102
1456
  * #history
1103
- * [returns a PaginatedResult model](./spec/acceptance/rest/channel_spec.rb#L119)
1104
- * [returns the current message history for the channel](./spec/acceptance/rest/channel_spec.rb#L123)
1105
- * [returns paged history using the PaginatedResult model](./spec/acceptance/rest/channel_spec.rb#L151)
1457
+ * [returns a PaginatedResult model](./spec/acceptance/rest/channel_spec.rb#L278)
1458
+ * [returns the current message history for the channel](./spec/acceptance/rest/channel_spec.rb#L282)
1459
+ * [returns paged history using the PaginatedResult model](./spec/acceptance/rest/channel_spec.rb#L310)
1106
1460
  * message timestamps
1107
- * [are after the messages were published](./spec/acceptance/rest/channel_spec.rb#L136)
1461
+ * [are after the messages were published](./spec/acceptance/rest/channel_spec.rb#L295)
1108
1462
  * message IDs
1109
- * [is unique](./spec/acceptance/rest/channel_spec.rb#L144)
1463
+ * [is unique](./spec/acceptance/rest/channel_spec.rb#L303)
1110
1464
  * direction
1111
- * [returns paged history backwards by default](./spec/acceptance/rest/channel_spec.rb#L172)
1112
- * [returns history forward if specified in the options](./spec/acceptance/rest/channel_spec.rb#L178)
1465
+ * [returns paged history backwards by default](./spec/acceptance/rest/channel_spec.rb#L331)
1466
+ * [returns history forward if specified in the options](./spec/acceptance/rest/channel_spec.rb#L337)
1113
1467
  * limit
1114
- * [defaults to 100](./spec/acceptance/rest/channel_spec.rb#L190)
1468
+ * [defaults to 100](./spec/acceptance/rest/channel_spec.rb#L349)
1115
1469
  * #history option
1116
1470
  * :start
1117
1471
  * with milliseconds since epoch value
1118
- * [uses this value in the history request](./spec/acceptance/rest/channel_spec.rb#L233)
1472
+ * [uses this value in the history request](./spec/acceptance/rest/channel_spec.rb#L392)
1119
1473
  * with a Time object value
1120
- * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/channel_spec.rb#L243)
1474
+ * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/channel_spec.rb#L402)
1121
1475
  * :end
1122
1476
  * with milliseconds since epoch value
1123
- * [uses this value in the history request](./spec/acceptance/rest/channel_spec.rb#L233)
1477
+ * [uses this value in the history request](./spec/acceptance/rest/channel_spec.rb#L392)
1124
1478
  * with a Time object value
1125
- * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/channel_spec.rb#L243)
1479
+ * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/channel_spec.rb#L402)
1126
1480
  * when argument start is after end
1127
- * [should raise an exception](./spec/acceptance/rest/channel_spec.rb#L253)
1481
+ * [should raise an exception](./spec/acceptance/rest/channel_spec.rb#L412)
1128
1482
  * #presence
1129
- * [returns a REST Presence object](./spec/acceptance/rest/channel_spec.rb#L263)
1483
+ * [returns a REST Presence object](./spec/acceptance/rest/channel_spec.rb#L422)
1130
1484
 
1131
1485
  ### Ably::Rest::Channels
1132
1486
  _(see [spec/acceptance/rest/channels_spec.rb](./spec/acceptance/rest/channels_spec.rb))_
1133
- * using JSON and MsgPack protocol
1487
+ * using JSON protocol
1134
1488
  * using shortcut method #channel on the client object
1135
1489
  * behaves like a channel
1136
1490
  * [returns a channel object](./spec/acceptance/rest/channels_spec.rb#L6)
@@ -1150,7 +1504,7 @@ _(see [spec/acceptance/rest/channels_spec.rb](./spec/acceptance/rest/channels_sp
1150
1504
 
1151
1505
  ### Ably::Rest::Client
1152
1506
  _(see [spec/acceptance/rest/client_spec.rb](./spec/acceptance/rest/client_spec.rb))_
1153
- * using JSON and MsgPack protocol
1507
+ * using JSON protocol
1154
1508
  * #initialize
1155
1509
  * with only an API key
1156
1510
  * [uses basic authentication](./spec/acceptance/rest/client_spec.rb#L24)
@@ -1160,61 +1514,87 @@ _(see [spec/acceptance/rest/client_spec.rb](./spec/acceptance/rest/client_spec.r
1160
1514
  * [uses token authentication](./spec/acceptance/rest/client_spec.rb#L40)
1161
1515
  * with a :client_id configured
1162
1516
  * [uses token authentication](./spec/acceptance/rest/client_spec.rb#L48)
1517
+ * with an invalid wildcard "*" :client_id
1518
+ * [raises an exception](./spec/acceptance/rest/client_spec.rb#L54)
1163
1519
  * with an :auth_callback Proc
1164
- * [calls the auth Proc to get a new token](./spec/acceptance/rest/client_spec.rb#L56)
1165
- * [uses token authentication](./spec/acceptance/rest/client_spec.rb#L61)
1520
+ * [calls the auth Proc to get a new token](./spec/acceptance/rest/client_spec.rb#L62)
1521
+ * [uses token authentication](./spec/acceptance/rest/client_spec.rb#L67)
1522
+ * with an :auth_callback Proc (clientId provided in library options instead of as a token_request param)
1523
+ * [correctly sets the clientId on the token](./spec/acceptance/rest/client_spec.rb#L76)
1166
1524
  * with an auth URL
1167
- * [uses token authentication](./spec/acceptance/rest/client_spec.rb#L70)
1525
+ * [uses token authentication](./spec/acceptance/rest/client_spec.rb#L86)
1168
1526
  * before any REST request
1169
- * [sends an HTTP request to the provided auth URL to get a new token](./spec/acceptance/rest/client_spec.rb#L81)
1527
+ * [sends an HTTP request to the provided auth URL to get a new token](./spec/acceptance/rest/client_spec.rb#L97)
1170
1528
  * auth headers
1171
1529
  * with basic auth
1172
- * [sends the API key in authentication part of the secure URL (the Authorization: Basic header is not used with the Faraday HTTP library by default)](./spec/acceptance/rest/client_spec.rb#L101)
1530
+ * [sends the API key in authentication part of the secure URL (the Authorization: Basic header is not used with the Faraday HTTP library by default)](./spec/acceptance/rest/client_spec.rb#L117)
1173
1531
  * with token auth
1174
1532
  * without specifying protocol
1175
- * [sends the token string over HTTPS in the Authorization Bearer header with Base64 encoding](./spec/acceptance/rest/client_spec.rb#L120)
1533
+ * [sends the token string over HTTPS in the Authorization Bearer header with Base64 encoding](./spec/acceptance/rest/client_spec.rb#L136)
1176
1534
  * when setting constructor ClientOption :tls to false
1177
- * [sends the token string over HTTP in the Authorization Bearer header with Base64 encoding](./spec/acceptance/rest/client_spec.rb#L130)
1535
+ * [sends the token string over HTTP in the Authorization Bearer header with Base64 encoding](./spec/acceptance/rest/client_spec.rb#L146)
1178
1536
  * using tokens
1179
1537
  * when expired
1180
- * [creates a new token automatically when the old token expires](./spec/acceptance/rest/client_spec.rb#L161)
1538
+ * [creates a new token automatically when the old token expires](./spec/acceptance/rest/client_spec.rb#L179)
1539
+ * with a different client_id in the subsequent token
1540
+ * [fails to authenticate and raises an exception](./spec/acceptance/rest/client_spec.rb#L192)
1181
1541
  * when token has not expired
1182
- * [reuses the existing token for every request](./spec/acceptance/rest/client_spec.rb#L175)
1542
+ * [reuses the existing token for every request](./spec/acceptance/rest/client_spec.rb#L203)
1183
1543
  * connection transport
1184
- * for default host
1185
- * [is configured to timeout connection opening in 4 seconds](./spec/acceptance/rest/client_spec.rb#L191)
1186
- * [is configured to timeout connection requests in 15 seconds](./spec/acceptance/rest/client_spec.rb#L195)
1187
- * for the fallback hosts
1188
- * [is configured to timeout connection opening in 4 seconds](./spec/acceptance/rest/client_spec.rb#L201)
1189
- * [is configured to timeout connection requests in 15 seconds](./spec/acceptance/rest/client_spec.rb#L205)
1544
+ * defaults
1545
+ * for default host
1546
+ * [is configured to timeout connection opening in 4 seconds](./spec/acceptance/rest/client_spec.rb#L220)
1547
+ * [is configured to timeout connection requests in 15 seconds](./spec/acceptance/rest/client_spec.rb#L224)
1548
+ * for the fallback hosts
1549
+ * [is configured to timeout connection opening in 4 seconds](./spec/acceptance/rest/client_spec.rb#L230)
1550
+ * [is configured to timeout connection requests in 15 seconds](./spec/acceptance/rest/client_spec.rb#L234)
1551
+ * with custom http_open_timeout and http_request_timeout options
1552
+ * for default host
1553
+ * [is configured to use custom open timeout](./spec/acceptance/rest/client_spec.rb#L246)
1554
+ * [is configured to use custom request timeout](./spec/acceptance/rest/client_spec.rb#L250)
1555
+ * for the fallback hosts
1556
+ * [is configured to timeout connection opening in 4 seconds](./spec/acceptance/rest/client_spec.rb#L256)
1557
+ * [is configured to timeout connection requests in 15 seconds](./spec/acceptance/rest/client_spec.rb#L260)
1190
1558
  * fallback hosts
1191
1559
  * configured
1192
- * [should make connection attempts to A.ably-realtime.com, B.ably-realtime.com, C.ably-realtime.com, D.ably-realtime.com, E.ably-realtime.com](./spec/acceptance/rest/client_spec.rb#L218)
1560
+ * [should make connection attempts to A.ably-realtime.com, B.ably-realtime.com, C.ably-realtime.com, D.ably-realtime.com, E.ably-realtime.com](./spec/acceptance/rest/client_spec.rb#L274)
1193
1561
  * when environment is NOT production
1194
- * [does not retry failed requests with fallback hosts when there is a connection error](./spec/acceptance/rest/client_spec.rb#L235)
1562
+ * [does not retry failed requests with fallback hosts when there is a connection error](./spec/acceptance/rest/client_spec.rb#L291)
1195
1563
  * when environment is production
1196
1564
  * and connection times out
1197
- * [tries fallback hosts 3 times](./spec/acceptance/rest/client_spec.rb#L272)
1565
+ * [tries fallback hosts 3 times](./spec/acceptance/rest/client_spec.rb#L329)
1198
1566
  * and the total request time exeeds 10 seconds
1199
- * [makes no further attempts to any fallback hosts](./spec/acceptance/rest/client_spec.rb#L287)
1567
+ * [makes no further attempts to any fallback hosts](./spec/acceptance/rest/client_spec.rb#L344)
1200
1568
  * and connection fails
1201
- * [tries fallback hosts 3 times](./spec/acceptance/rest/client_spec.rb#L303)
1569
+ * [tries fallback hosts 3 times](./spec/acceptance/rest/client_spec.rb#L360)
1202
1570
  * and basic authentication fails
1203
- * [does not attempt the fallback hosts as this is an authentication failure](./spec/acceptance/rest/client_spec.rb#L327)
1571
+ * [does not attempt the fallback hosts as this is an authentication failure](./spec/acceptance/rest/client_spec.rb#L384)
1204
1572
  * and server returns a 50x error
1205
- * [attempts the fallback hosts as this is an authentication failure](./spec/acceptance/rest/client_spec.rb#L349)
1573
+ * [attempts the fallback hosts as this is an authentication failure](./spec/acceptance/rest/client_spec.rb#L406)
1206
1574
  * with a custom host
1207
1575
  * that does not exist
1208
- * [fails immediately and raises a Faraday Error](./spec/acceptance/rest/client_spec.rb#L365)
1576
+ * [fails immediately and raises a Faraday Error](./spec/acceptance/rest/client_spec.rb#L422)
1209
1577
  * fallback hosts
1210
- * [are never used](./spec/acceptance/rest/client_spec.rb#L386)
1578
+ * [are never used](./spec/acceptance/rest/client_spec.rb#L443)
1211
1579
  * that times out
1212
- * [fails immediately and raises a Faraday Error](./spec/acceptance/rest/client_spec.rb#L401)
1580
+ * [fails immediately and raises a Faraday Error](./spec/acceptance/rest/client_spec.rb#L458)
1213
1581
  * fallback hosts
1214
- * [are never used](./spec/acceptance/rest/client_spec.rb#L414)
1582
+ * [are never used](./spec/acceptance/rest/client_spec.rb#L471)
1583
+ * HTTP configuration options
1584
+ * [is frozen](./spec/acceptance/rest/client_spec.rb#L528)
1585
+ * defaults
1586
+ * [#http_open_timeout is 4s](./spec/acceptance/rest/client_spec.rb#L483)
1587
+ * [#http_request_timeout is 15s](./spec/acceptance/rest/client_spec.rb#L487)
1588
+ * [#http_max_retry_count is 3](./spec/acceptance/rest/client_spec.rb#L491)
1589
+ * [#http_max_retry_duration is 10s](./spec/acceptance/rest/client_spec.rb#L495)
1590
+ * configured
1591
+ * [#http_open_timeout uses provided value](./spec/acceptance/rest/client_spec.rb#L511)
1592
+ * [#http_request_timeout uses provided value](./spec/acceptance/rest/client_spec.rb#L515)
1593
+ * [#http_max_retry_count uses provided value](./spec/acceptance/rest/client_spec.rb#L519)
1594
+ * [#http_max_retry_duration uses provided value](./spec/acceptance/rest/client_spec.rb#L523)
1215
1595
  * #auth
1216
- * [is provides access to the Auth object](./spec/acceptance/rest/client_spec.rb#L428)
1217
- * [configures the Auth object with all ClientOptions passed to client in the initializer](./spec/acceptance/rest/client_spec.rb#L432)
1596
+ * [is provides access to the Auth object](./spec/acceptance/rest/client_spec.rb#L539)
1597
+ * [configures the Auth object with all ClientOptions passed to client in the initializer](./spec/acceptance/rest/client_spec.rb#L543)
1218
1598
 
1219
1599
  ### Ably::Models::MessageEncoders
1220
1600
  _(see [spec/acceptance/rest/encoders_spec.rb](./spec/acceptance/rest/encoders_spec.rb))_
@@ -1251,7 +1631,7 @@ _(see [spec/acceptance/rest/encoders_spec.rb](./spec/acceptance/rest/encoders_sp
1251
1631
 
1252
1632
  ### Ably::Rest::Channel messages
1253
1633
  _(see [spec/acceptance/rest/message_spec.rb](./spec/acceptance/rest/message_spec.rb))_
1254
- * using JSON and MsgPack protocol
1634
+ * using JSON protocol
1255
1635
  * publishing with an ASCII_8BIT message name
1256
1636
  * [is converted into UTF_8](./spec/acceptance/rest/message_spec.rb#L18)
1257
1637
  * with supported data payload content type
@@ -1328,7 +1708,7 @@ _(see [spec/acceptance/rest/message_spec.rb](./spec/acceptance/rest/message_spec
1328
1708
 
1329
1709
  ### Ably::Rest::Presence
1330
1710
  _(see [spec/acceptance/rest/presence_spec.rb](./spec/acceptance/rest/presence_spec.rb))_
1331
- * using JSON and MsgPack protocol
1711
+ * using JSON protocol
1332
1712
  * tested against presence fixture data set up in test app
1333
1713
  * #get
1334
1714
  * [returns current members on the channel with their action set to :present](./spec/acceptance/rest/presence_spec.rb#L41)
@@ -1337,61 +1717,62 @@ _(see [spec/acceptance/rest/presence_spec.rb](./spec/acceptance/rest/presence_sp
1337
1717
  * default :limit
1338
1718
  * [defaults to a limit of 100](./spec/acceptance/rest/presence_spec.rb#L89)
1339
1719
  * with :client_id option
1340
- * PENDING: *[returns a list members filtered by the provided client ID](./spec/acceptance/rest/presence_spec.rb#L98)*
1720
+ * [returns a list members filtered by the provided client ID](./spec/acceptance/rest/presence_spec.rb#L98)
1341
1721
  * with :connection_id option
1342
- * PENDING: *[returns a list members filtered by the provided connection ID](./spec/acceptance/rest/presence_spec.rb#L109)*
1722
+ * [returns a list members filtered by the provided connection ID](./spec/acceptance/rest/presence_spec.rb#L109)
1723
+ * [returns a list members filtered by the provided connection ID](./spec/acceptance/rest/presence_spec.rb#L113)
1343
1724
  * #history
1344
- * [returns recent presence activity](./spec/acceptance/rest/presence_spec.rb#L120)
1725
+ * [returns recent presence activity](./spec/acceptance/rest/presence_spec.rb#L122)
1345
1726
  * default behaviour
1346
- * [uses backwards direction](./spec/acceptance/rest/presence_spec.rb#L135)
1727
+ * [uses backwards direction](./spec/acceptance/rest/presence_spec.rb#L137)
1347
1728
  * with options
1348
1729
  * direction: :forwards
1349
- * [returns recent presence activity forwards with most recent history last](./spec/acceptance/rest/presence_spec.rb#L147)
1730
+ * [returns recent presence activity forwards with most recent history last](./spec/acceptance/rest/presence_spec.rb#L149)
1350
1731
  * direction: :backwards
1351
- * [returns recent presence activity backwards with most recent history first](./spec/acceptance/rest/presence_spec.rb#L162)
1732
+ * [returns recent presence activity backwards with most recent history first](./spec/acceptance/rest/presence_spec.rb#L164)
1352
1733
  * #history
1353
1734
  * with options
1354
1735
  * limit options
1355
1736
  * default
1356
- * [is set to 100](./spec/acceptance/rest/presence_spec.rb#L210)
1737
+ * [is set to 100](./spec/acceptance/rest/presence_spec.rb#L212)
1357
1738
  * set to 1000
1358
- * [is passes the limit query param value 1000](./spec/acceptance/rest/presence_spec.rb#L223)
1739
+ * [is passes the limit query param value 1000](./spec/acceptance/rest/presence_spec.rb#L225)
1359
1740
  * with time range options
1360
1741
  * :start
1361
1742
  * with milliseconds since epoch value
1362
- * [uses this value in the history request](./spec/acceptance/rest/presence_spec.rb#L253)
1743
+ * [uses this value in the history request](./spec/acceptance/rest/presence_spec.rb#L255)
1363
1744
  * with Time object value
1364
- * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/presence_spec.rb#L263)
1745
+ * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/presence_spec.rb#L265)
1365
1746
  * :end
1366
1747
  * with milliseconds since epoch value
1367
- * [uses this value in the history request](./spec/acceptance/rest/presence_spec.rb#L253)
1748
+ * [uses this value in the history request](./spec/acceptance/rest/presence_spec.rb#L255)
1368
1749
  * with Time object value
1369
- * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/presence_spec.rb#L263)
1750
+ * [converts the value to milliseconds since epoch in the hisotry request](./spec/acceptance/rest/presence_spec.rb#L265)
1370
1751
  * when argument start is after end
1371
- * [should raise an exception](./spec/acceptance/rest/presence_spec.rb#L274)
1752
+ * [should raise an exception](./spec/acceptance/rest/presence_spec.rb#L276)
1372
1753
  * decoding
1373
1754
  * with encoded fixture data
1374
1755
  * #history
1375
- * [decodes encoded and encryped presence fixture data automatically](./spec/acceptance/rest/presence_spec.rb#L293)
1756
+ * [decodes encoded and encryped presence fixture data automatically](./spec/acceptance/rest/presence_spec.rb#L295)
1376
1757
  * #get
1377
- * [decodes encoded and encryped presence fixture data automatically](./spec/acceptance/rest/presence_spec.rb#L300)
1758
+ * [decodes encoded and encryped presence fixture data automatically](./spec/acceptance/rest/presence_spec.rb#L302)
1378
1759
  * decoding permutations using mocked #history
1379
1760
  * valid decodeable content
1380
1761
  * #get
1381
- * [automaticaly decodes presence messages](./spec/acceptance/rest/presence_spec.rb#L356)
1762
+ * [automaticaly decodes presence messages](./spec/acceptance/rest/presence_spec.rb#L358)
1382
1763
  * #history
1383
- * [automaticaly decodes presence messages](./spec/acceptance/rest/presence_spec.rb#L373)
1764
+ * [automaticaly decodes presence messages](./spec/acceptance/rest/presence_spec.rb#L375)
1384
1765
  * invalid data
1385
1766
  * #get
1386
- * [returns the messages still encoded](./spec/acceptance/rest/presence_spec.rb#L404)
1387
- * [logs a cipher error](./spec/acceptance/rest/presence_spec.rb#L408)
1767
+ * [returns the messages still encoded](./spec/acceptance/rest/presence_spec.rb#L406)
1768
+ * [logs a cipher error](./spec/acceptance/rest/presence_spec.rb#L410)
1388
1769
  * #history
1389
- * [returns the messages still encoded](./spec/acceptance/rest/presence_spec.rb#L428)
1390
- * [logs a cipher error](./spec/acceptance/rest/presence_spec.rb#L432)
1770
+ * [returns the messages still encoded](./spec/acceptance/rest/presence_spec.rb#L430)
1771
+ * [logs a cipher error](./spec/acceptance/rest/presence_spec.rb#L434)
1391
1772
 
1392
1773
  ### Ably::Rest::Client#stats
1393
1774
  _(see [spec/acceptance/rest/stats_spec.rb](./spec/acceptance/rest/stats_spec.rb))_
1394
- * using JSON and MsgPack protocol
1775
+ * using JSON protocol
1395
1776
  * fetching application stats
1396
1777
  * [returns a PaginatedResult object](./spec/acceptance/rest/stats_spec.rb#L54)
1397
1778
  * by minute
@@ -1435,9 +1816,11 @@ _(see [spec/acceptance/rest/stats_spec.rb](./spec/acceptance/rest/stats_spec.rb)
1435
1816
 
1436
1817
  ### Ably::Rest::Client#time
1437
1818
  _(see [spec/acceptance/rest/time_spec.rb](./spec/acceptance/rest/time_spec.rb))_
1438
- * using JSON and MsgPack protocol
1819
+ * using JSON protocol
1439
1820
  * fetching the service time
1440
1821
  * [should return the service time as a Time object](./spec/acceptance/rest/time_spec.rb#L10)
1822
+ * with reconfigured HTTP timeout
1823
+ * [should raise a timeout exception](./spec/acceptance/rest/time_spec.rb#L19)
1441
1824
 
1442
1825
  ### Ably::Auth
1443
1826
  _(see [spec/unit/auth_spec.rb](./spec/unit/auth_spec.rb))_
@@ -1469,6 +1852,66 @@ _(see [spec/unit/logger_spec.rb](./spec/unit/logger_spec.rb))_
1469
1852
  * with a valid interface
1470
1853
  * [is used](./spec/unit/logger_spec.rb#L135)
1471
1854
 
1855
+ ### Ably::Models::ChannelStateChange
1856
+ _(see [spec/unit/models/channel_state_change_spec.rb](./spec/unit/models/channel_state_change_spec.rb))_
1857
+ * #current
1858
+ * [is required](./spec/unit/models/channel_state_change_spec.rb#L10)
1859
+ * [is an attribute](./spec/unit/models/channel_state_change_spec.rb#L14)
1860
+ * #previous
1861
+ * [is required](./spec/unit/models/channel_state_change_spec.rb#L20)
1862
+ * [is an attribute](./spec/unit/models/channel_state_change_spec.rb#L24)
1863
+ * #reason
1864
+ * [is not required](./spec/unit/models/channel_state_change_spec.rb#L30)
1865
+ * [is an attribute](./spec/unit/models/channel_state_change_spec.rb#L34)
1866
+ * invalid attributes
1867
+ * [raises an argument error](./spec/unit/models/channel_state_change_spec.rb#L40)
1868
+
1869
+ ### Ably::Models::ConnectionDetails
1870
+ _(see [spec/unit/models/connection_details_spec.rb](./spec/unit/models/connection_details_spec.rb))_
1871
+ * behaves like a model
1872
+ * attributes
1873
+ * #client_id
1874
+ * [retrieves attribute :client_id](./spec/shared/model_behaviour.rb#L15)
1875
+ * #connection_key
1876
+ * [retrieves attribute :connection_key](./spec/shared/model_behaviour.rb#L15)
1877
+ * #max_message_size
1878
+ * [retrieves attribute :max_message_size](./spec/shared/model_behaviour.rb#L15)
1879
+ * #max_frame_size
1880
+ * [retrieves attribute :max_frame_size](./spec/shared/model_behaviour.rb#L15)
1881
+ * #max_inbound_rate
1882
+ * [retrieves attribute :max_inbound_rate](./spec/shared/model_behaviour.rb#L15)
1883
+ * #==
1884
+ * [is true when attributes are the same](./spec/shared/model_behaviour.rb#L41)
1885
+ * [is false when attributes are not the same](./spec/shared/model_behaviour.rb#L46)
1886
+ * [is false when class type differs](./spec/shared/model_behaviour.rb#L50)
1887
+ * is immutable
1888
+ * [prevents changes](./spec/shared/model_behaviour.rb#L76)
1889
+ * [dups options](./spec/shared/model_behaviour.rb#L80)
1890
+ * attributes
1891
+ * #connection_state_ttl
1892
+ * [retrieves attribute :connection_state_ttl and converts it from ms to s](./spec/unit/models/connection_details_spec.rb#L19)
1893
+ * ==
1894
+ * [is true when attributes are the same](./spec/unit/models/connection_details_spec.rb#L28)
1895
+ * [is false when attributes are not the same](./spec/unit/models/connection_details_spec.rb#L33)
1896
+ * [is false when class type differs](./spec/unit/models/connection_details_spec.rb#L37)
1897
+
1898
+ ### Ably::Models::ConnectionStateChange
1899
+ _(see [spec/unit/models/connection_state_change_spec.rb](./spec/unit/models/connection_state_change_spec.rb))_
1900
+ * #current
1901
+ * [is required](./spec/unit/models/connection_state_change_spec.rb#L10)
1902
+ * [is an attribute](./spec/unit/models/connection_state_change_spec.rb#L14)
1903
+ * #previous
1904
+ * [is required](./spec/unit/models/connection_state_change_spec.rb#L20)
1905
+ * [is an attribute](./spec/unit/models/connection_state_change_spec.rb#L24)
1906
+ * #retry_in
1907
+ * [is not required](./spec/unit/models/connection_state_change_spec.rb#L30)
1908
+ * [is an attribute](./spec/unit/models/connection_state_change_spec.rb#L34)
1909
+ * #reason
1910
+ * [is not required](./spec/unit/models/connection_state_change_spec.rb#L40)
1911
+ * [is an attribute](./spec/unit/models/connection_state_change_spec.rb#L44)
1912
+ * invalid attributes
1913
+ * [raises an argument error](./spec/unit/models/connection_state_change_spec.rb#L50)
1914
+
1472
1915
  ### Ably::Models::ErrorInfo
1473
1916
  _(see [spec/unit/models/error_info_spec.rb](./spec/unit/models/error_info_spec.rb))_
1474
1917
  * behaves like a model
@@ -1907,6 +2350,17 @@ _(see [spec/unit/models/protocol_message_spec.rb](./spec/unit/models/protocol_me
1907
2350
  * [contains Message objects](./spec/unit/models/protocol_message_spec.rb#L271)
1908
2351
  * #presence
1909
2352
  * [contains PresenceMessage objects](./spec/unit/models/protocol_message_spec.rb#L281)
2353
+ * #connection_details
2354
+ * with a JSON value
2355
+ * [contains a ConnectionDetails object](./spec/unit/models/protocol_message_spec.rb#L294)
2356
+ * [contains the attributes from the JSON connectionDetails](./spec/unit/models/protocol_message_spec.rb#L298)
2357
+ * without a JSON value
2358
+ * [contains an empty ConnectionDetails object](./spec/unit/models/protocol_message_spec.rb#L307)
2359
+ * #connection_key
2360
+ * existing only in #connection_details.connection_key
2361
+ * [is returned](./spec/unit/models/protocol_message_spec.rb#L319)
2362
+ * existing in both #connection_key and #connection_details.connection_key
2363
+ * [returns #connection_details.connection_key as #connection_key will be deprecated > 0.8](./spec/unit/models/protocol_message_spec.rb#L327)
1910
2364
 
1911
2365
  ### Ably::Models::Stats
1912
2366
  _(see [spec/unit/models/stats_spec.rb](./spec/unit/models/stats_spec.rb))_
@@ -2075,10 +2529,12 @@ _(see [spec/unit/models/token_details_spec.rb](./spec/unit/models/token_details_
2075
2529
  * [is true](./spec/unit/models/token_details_spec.rb#L61)
2076
2530
  * within grace period buffer
2077
2531
  * [is false](./spec/unit/models/token_details_spec.rb#L69)
2532
+ * when expires is not available (i.e. string tokens)
2533
+ * [is always false](./spec/unit/models/token_details_spec.rb#L77)
2078
2534
  * ==
2079
- * [is true when attributes are the same](./spec/unit/models/token_details_spec.rb#L79)
2080
- * [is false when attributes are not the same](./spec/unit/models/token_details_spec.rb#L84)
2081
- * [is false when class type differs](./spec/unit/models/token_details_spec.rb#L88)
2535
+ * [is true when attributes are the same](./spec/unit/models/token_details_spec.rb#L87)
2536
+ * [is false when attributes are not the same](./spec/unit/models/token_details_spec.rb#L92)
2537
+ * [is false when class type differs](./spec/unit/models/token_details_spec.rb#L96)
2082
2538
 
2083
2539
  ### Ably::Models::TokenRequest
2084
2540
  _(see [spec/unit/models/token_request_spec.rb](./spec/unit/models/token_request_spec.rb))_
@@ -2122,35 +2578,35 @@ _(see [spec/unit/models/token_request_spec.rb](./spec/unit/models/token_request_
2122
2578
  ### Ably::Modules::EventEmitter
2123
2579
  _(see [spec/unit/modules/event_emitter_spec.rb](./spec/unit/modules/event_emitter_spec.rb))_
2124
2580
  * #emit event fan out
2125
- * [should emit an event for any number of subscribers](./spec/unit/modules/event_emitter_spec.rb#L19)
2126
- * [sends only messages to matching event names](./spec/unit/modules/event_emitter_spec.rb#L28)
2581
+ * [should emit an event for any number of subscribers](./spec/unit/modules/event_emitter_spec.rb#L21)
2582
+ * [sends only messages to matching event names](./spec/unit/modules/event_emitter_spec.rb#L30)
2127
2583
  * #on subscribe to multiple events
2128
- * [with the same block](./spec/unit/modules/event_emitter_spec.rb#L60)
2584
+ * [with the same block](./spec/unit/modules/event_emitter_spec.rb#L62)
2129
2585
  * event callback changes within the callback block
2130
2586
  * when new event callbacks are added
2131
- * [is unaffected and processes the prior event callbacks once](./spec/unit/modules/event_emitter_spec.rb#L84)
2132
- * [adds them for the next emitted event](./spec/unit/modules/event_emitter_spec.rb#L90)
2587
+ * [is unaffected and processes the prior event callbacks once](./spec/unit/modules/event_emitter_spec.rb#L86)
2588
+ * [adds them for the next emitted event](./spec/unit/modules/event_emitter_spec.rb#L92)
2133
2589
  * when callbacks are removed
2134
- * [is unaffected and processes the prior event callbacks once](./spec/unit/modules/event_emitter_spec.rb#L111)
2135
- * [removes them for the next emitted event](./spec/unit/modules/event_emitter_spec.rb#L116)
2590
+ * [is unaffected and processes the prior event callbacks once](./spec/unit/modules/event_emitter_spec.rb#L113)
2591
+ * [removes them for the next emitted event](./spec/unit/modules/event_emitter_spec.rb#L118)
2136
2592
  * #on
2137
- * [calls the block every time an event is emitted only](./spec/unit/modules/event_emitter_spec.rb#L129)
2138
- * [catches exceptions in the provided block, logs the error and continues](./spec/unit/modules/event_emitter_spec.rb#L136)
2593
+ * [calls the block every time an event is emitted only](./spec/unit/modules/event_emitter_spec.rb#L131)
2594
+ * [catches exceptions in the provided block, logs the error and continues](./spec/unit/modules/event_emitter_spec.rb#L138)
2139
2595
  * #once
2140
- * [calls the block the first time an event is emitted only](./spec/unit/modules/event_emitter_spec.rb#L158)
2141
- * [does not remove other blocks after it is called](./spec/unit/modules/event_emitter_spec.rb#L165)
2142
- * [catches exceptions in the provided block, logs the error and continues](./spec/unit/modules/event_emitter_spec.rb#L173)
2596
+ * [calls the block the first time an event is emitted only](./spec/unit/modules/event_emitter_spec.rb#L160)
2597
+ * [does not remove other blocks after it is called](./spec/unit/modules/event_emitter_spec.rb#L167)
2598
+ * [catches exceptions in the provided block, logs the error and continues](./spec/unit/modules/event_emitter_spec.rb#L175)
2143
2599
  * #unsafe_once
2144
- * [calls the block the first time an event is emitted only](./spec/unit/modules/event_emitter_spec.rb#L181)
2145
- * [does not catch exceptions in provided blocks](./spec/unit/modules/event_emitter_spec.rb#L188)
2600
+ * [calls the block the first time an event is emitted only](./spec/unit/modules/event_emitter_spec.rb#L183)
2601
+ * [does not catch exceptions in provided blocks](./spec/unit/modules/event_emitter_spec.rb#L190)
2146
2602
  * #off
2147
2603
  * with event names as arguments
2148
- * [deletes matching callbacks](./spec/unit/modules/event_emitter_spec.rb#L206)
2149
- * [deletes all callbacks if not block given](./spec/unit/modules/event_emitter_spec.rb#L211)
2150
- * [continues if the block does not exist](./spec/unit/modules/event_emitter_spec.rb#L216)
2604
+ * [deletes matching callbacks](./spec/unit/modules/event_emitter_spec.rb#L208)
2605
+ * [deletes all callbacks if not block given](./spec/unit/modules/event_emitter_spec.rb#L213)
2606
+ * [continues if the block does not exist](./spec/unit/modules/event_emitter_spec.rb#L218)
2151
2607
  * without any event names
2152
- * [deletes all matching callbacks](./spec/unit/modules/event_emitter_spec.rb#L223)
2153
- * [deletes all callbacks if not block given](./spec/unit/modules/event_emitter_spec.rb#L228)
2608
+ * [deletes all matching callbacks](./spec/unit/modules/event_emitter_spec.rb#L225)
2609
+ * [deletes all callbacks if not block given](./spec/unit/modules/event_emitter_spec.rb#L230)
2154
2610
 
2155
2611
  ### Ably::Modules::StateEmitter
2156
2612
  _(see [spec/unit/modules/state_emitter_spec.rb](./spec/unit/modules/state_emitter_spec.rb))_
@@ -2184,31 +2640,31 @@ _(see [spec/unit/realtime/channel_spec.rb](./spec/unit/realtime/channel_spec.rb)
2184
2640
  * [raises an argument error](./spec/unit/realtime/channel_spec.rb#L63)
2185
2641
  * #publish name argument
2186
2642
  * as UTF_8 string
2187
- * [is permitted](./spec/unit/realtime/channel_spec.rb#L80)
2643
+ * [is permitted](./spec/unit/realtime/channel_spec.rb#L81)
2188
2644
  * as SHIFT_JIS string
2189
- * [is permitted](./spec/unit/realtime/channel_spec.rb#L88)
2645
+ * [is permitted](./spec/unit/realtime/channel_spec.rb#L89)
2190
2646
  * as ASCII_8BIT string
2191
- * [is permitted](./spec/unit/realtime/channel_spec.rb#L96)
2647
+ * [is permitted](./spec/unit/realtime/channel_spec.rb#L97)
2192
2648
  * as Integer
2193
- * [raises an argument error](./spec/unit/realtime/channel_spec.rb#L104)
2649
+ * [raises an argument error](./spec/unit/realtime/channel_spec.rb#L105)
2194
2650
  * as Nil
2195
- * [is permitted](./spec/unit/realtime/channel_spec.rb#L112)
2651
+ * [is permitted](./spec/unit/realtime/channel_spec.rb#L113)
2196
2652
  * callbacks
2197
- * [are supported for valid STATE events](./spec/unit/realtime/channel_spec.rb#L119)
2198
- * [fail with unacceptable STATE event names](./spec/unit/realtime/channel_spec.rb#L125)
2653
+ * [are supported for valid STATE events](./spec/unit/realtime/channel_spec.rb#L120)
2654
+ * [fail with unacceptable STATE event names](./spec/unit/realtime/channel_spec.rb#L126)
2199
2655
  * subscriptions
2200
2656
  * #subscribe
2201
- * [without a block raises an invalid ArgumentError](./spec/unit/realtime/channel_spec.rb#L167)
2202
- * [with no event name specified subscribes the provided block to all events](./spec/unit/realtime/channel_spec.rb#L171)
2203
- * [with a single event name subscribes that block to matching events](./spec/unit/realtime/channel_spec.rb#L177)
2204
- * [with a multiple event name arguments subscribes that block to all of those event names](./spec/unit/realtime/channel_spec.rb#L184)
2205
- * [with a multiple duplicate event name arguments subscribes that block to all of those unique event names once](./spec/unit/realtime/channel_spec.rb#L196)
2657
+ * [without a block raises an invalid ArgumentError](./spec/unit/realtime/channel_spec.rb#L168)
2658
+ * [with no event name specified subscribes the provided block to all events](./spec/unit/realtime/channel_spec.rb#L172)
2659
+ * [with a single event name subscribes that block to matching events](./spec/unit/realtime/channel_spec.rb#L178)
2660
+ * [with a multiple event name arguments subscribes that block to all of those event names](./spec/unit/realtime/channel_spec.rb#L185)
2661
+ * [with a multiple duplicate event name arguments subscribes that block to all of those unique event names once](./spec/unit/realtime/channel_spec.rb#L197)
2206
2662
  * #unsubscribe
2207
- * [with no event name specified unsubscribes that block from all events](./spec/unit/realtime/channel_spec.rb#L213)
2208
- * [with a single event name argument unsubscribes the provided block with the matching event name](./spec/unit/realtime/channel_spec.rb#L219)
2209
- * [with multiple event name arguments unsubscribes each of those matching event names with the provided block](./spec/unit/realtime/channel_spec.rb#L225)
2210
- * [with a non-matching event name argument has no effect](./spec/unit/realtime/channel_spec.rb#L231)
2211
- * [with no block argument unsubscribes all blocks for the event name argument](./spec/unit/realtime/channel_spec.rb#L237)
2663
+ * [with no event name specified unsubscribes that block from all events](./spec/unit/realtime/channel_spec.rb#L214)
2664
+ * [with a single event name argument unsubscribes the provided block with the matching event name](./spec/unit/realtime/channel_spec.rb#L220)
2665
+ * [with multiple event name arguments unsubscribes each of those matching event names with the provided block](./spec/unit/realtime/channel_spec.rb#L226)
2666
+ * [with a non-matching event name argument has no effect](./spec/unit/realtime/channel_spec.rb#L232)
2667
+ * [with no block argument unsubscribes all blocks for the event name argument](./spec/unit/realtime/channel_spec.rb#L238)
2212
2668
 
2213
2669
  ### Ably::Realtime::Channels
2214
2670
  _(see [spec/unit/realtime/channels_spec.rb](./spec/unit/realtime/channels_spec.rb))_
@@ -2255,47 +2711,47 @@ _(see [spec/unit/realtime/client_spec.rb](./spec/unit/realtime/client_spec.rb))_
2255
2711
  * [connects to the Ably service](./spec/shared/client_initializer_behaviour.rb#L87)
2256
2712
  * [uses basic auth](./spec/shared/client_initializer_behaviour.rb#L91)
2257
2713
  * with a string key instead of options hash
2258
- * [sets the key](./spec/shared/client_initializer_behaviour.rb#L107)
2259
- * [sets the key_name](./spec/shared/client_initializer_behaviour.rb#L111)
2260
- * [sets the key_secret](./spec/shared/client_initializer_behaviour.rb#L115)
2261
- * [uses basic auth](./spec/shared/client_initializer_behaviour.rb#L119)
2714
+ * [sets the key](./spec/shared/client_initializer_behaviour.rb#L111)
2715
+ * [sets the key_name](./spec/shared/client_initializer_behaviour.rb#L115)
2716
+ * [sets the key_secret](./spec/shared/client_initializer_behaviour.rb#L119)
2717
+ * [uses basic auth](./spec/shared/client_initializer_behaviour.rb#L123)
2262
2718
  * with a string token key instead of options hash
2263
- * [sets the token](./spec/shared/client_initializer_behaviour.rb#L127)
2264
- * with token
2265
2719
  * [sets the token](./spec/shared/client_initializer_behaviour.rb#L135)
2266
- * with token_details
2720
+ * with token
2267
2721
  * [sets the token](./spec/shared/client_initializer_behaviour.rb#L143)
2722
+ * with token_details
2723
+ * [sets the token](./spec/shared/client_initializer_behaviour.rb#L151)
2268
2724
  * with token_params
2269
- * [configures the default token_params](./spec/shared/client_initializer_behaviour.rb#L151)
2725
+ * [configures the default token_params](./spec/shared/client_initializer_behaviour.rb#L159)
2270
2726
  * endpoint
2271
- * [defaults to production](./spec/shared/client_initializer_behaviour.rb#L158)
2727
+ * [defaults to production](./spec/shared/client_initializer_behaviour.rb#L170)
2272
2728
  * with environment option
2273
- * [uses an alternate endpoint](./spec/shared/client_initializer_behaviour.rb#L165)
2729
+ * [uses an alternate endpoint](./spec/shared/client_initializer_behaviour.rb#L177)
2274
2730
  * with rest_host option
2275
- * PENDING: *[uses an alternate endpoint for REST clients](./spec/shared/client_initializer_behaviour.rb#L173)*
2731
+ * PENDING: *[uses an alternate endpoint for REST clients](./spec/shared/client_initializer_behaviour.rb#L185)*
2276
2732
  * with realtime_host option
2277
- * [uses an alternate endpoint for Realtime clients](./spec/shared/client_initializer_behaviour.rb#L182)
2733
+ * [uses an alternate endpoint for Realtime clients](./spec/shared/client_initializer_behaviour.rb#L194)
2278
2734
  * with port option and non-TLS connections
2279
- * [uses the custom port for non-TLS requests](./spec/shared/client_initializer_behaviour.rb#L191)
2735
+ * [uses the custom port for non-TLS requests](./spec/shared/client_initializer_behaviour.rb#L203)
2280
2736
  * with tls_port option and a TLS connection
2281
- * [uses the custom port for TLS requests](./spec/shared/client_initializer_behaviour.rb#L199)
2737
+ * [uses the custom port for TLS requests](./spec/shared/client_initializer_behaviour.rb#L211)
2282
2738
  * tls
2283
- * [defaults to TLS](./spec/shared/client_initializer_behaviour.rb#L218)
2739
+ * [defaults to TLS](./spec/shared/client_initializer_behaviour.rb#L234)
2284
2740
  * set to false
2285
- * [uses plain text](./spec/shared/client_initializer_behaviour.rb#L209)
2286
- * [uses HTTP](./spec/shared/client_initializer_behaviour.rb#L213)
2741
+ * [uses plain text](./spec/shared/client_initializer_behaviour.rb#L225)
2742
+ * [uses HTTP](./spec/shared/client_initializer_behaviour.rb#L229)
2287
2743
  * logger
2288
2744
  * default
2289
- * [uses Ruby Logger](./spec/shared/client_initializer_behaviour.rb#L225)
2290
- * [specifies Logger::WARN log level](./spec/shared/client_initializer_behaviour.rb#L229)
2745
+ * [uses Ruby Logger](./spec/shared/client_initializer_behaviour.rb#L245)
2746
+ * [specifies Logger::WARN log level](./spec/shared/client_initializer_behaviour.rb#L249)
2291
2747
  * with log_level :none
2292
- * [silences all logging with a NilLogger](./spec/shared/client_initializer_behaviour.rb#L237)
2748
+ * [silences all logging with a NilLogger](./spec/shared/client_initializer_behaviour.rb#L257)
2293
2749
  * with custom logger and log_level
2294
- * [uses the custom logger](./spec/shared/client_initializer_behaviour.rb#L255)
2295
- * [sets the custom log level](./spec/shared/client_initializer_behaviour.rb#L259)
2750
+ * [uses the custom logger](./spec/shared/client_initializer_behaviour.rb#L275)
2751
+ * [sets the custom log level](./spec/shared/client_initializer_behaviour.rb#L279)
2296
2752
  * delegators
2297
- * [delegates :client_id to .auth](./spec/shared/client_initializer_behaviour.rb#L269)
2298
- * [delegates :auth_options to .auth](./spec/shared/client_initializer_behaviour.rb#L274)
2753
+ * [delegates :client_id to .auth](./spec/shared/client_initializer_behaviour.rb#L293)
2754
+ * [delegates :auth_options to .auth](./spec/shared/client_initializer_behaviour.rb#L298)
2299
2755
  * delegation to the REST Client
2300
2756
  * [passes on the options to the initializer](./spec/unit/realtime/client_spec.rb#L15)
2301
2757
  * for attribute
@@ -2442,47 +2898,47 @@ _(see [spec/unit/rest/client_spec.rb](./spec/unit/rest/client_spec.rb))_
2442
2898
  * [connects to the Ably service](./spec/shared/client_initializer_behaviour.rb#L87)
2443
2899
  * [uses basic auth](./spec/shared/client_initializer_behaviour.rb#L91)
2444
2900
  * with a string key instead of options hash
2445
- * [sets the key](./spec/shared/client_initializer_behaviour.rb#L107)
2446
- * [sets the key_name](./spec/shared/client_initializer_behaviour.rb#L111)
2447
- * [sets the key_secret](./spec/shared/client_initializer_behaviour.rb#L115)
2448
- * [uses basic auth](./spec/shared/client_initializer_behaviour.rb#L119)
2901
+ * [sets the key](./spec/shared/client_initializer_behaviour.rb#L111)
2902
+ * [sets the key_name](./spec/shared/client_initializer_behaviour.rb#L115)
2903
+ * [sets the key_secret](./spec/shared/client_initializer_behaviour.rb#L119)
2904
+ * [uses basic auth](./spec/shared/client_initializer_behaviour.rb#L123)
2449
2905
  * with a string token key instead of options hash
2450
- * [sets the token](./spec/shared/client_initializer_behaviour.rb#L127)
2451
- * with token
2452
2906
  * [sets the token](./spec/shared/client_initializer_behaviour.rb#L135)
2453
- * with token_details
2907
+ * with token
2454
2908
  * [sets the token](./spec/shared/client_initializer_behaviour.rb#L143)
2909
+ * with token_details
2910
+ * [sets the token](./spec/shared/client_initializer_behaviour.rb#L151)
2455
2911
  * with token_params
2456
- * [configures the default token_params](./spec/shared/client_initializer_behaviour.rb#L151)
2912
+ * [configures the default token_params](./spec/shared/client_initializer_behaviour.rb#L159)
2457
2913
  * endpoint
2458
- * [defaults to production](./spec/shared/client_initializer_behaviour.rb#L158)
2914
+ * [defaults to production](./spec/shared/client_initializer_behaviour.rb#L170)
2459
2915
  * with environment option
2460
- * [uses an alternate endpoint](./spec/shared/client_initializer_behaviour.rb#L165)
2916
+ * [uses an alternate endpoint](./spec/shared/client_initializer_behaviour.rb#L177)
2461
2917
  * with rest_host option
2462
- * [uses an alternate endpoint for REST clients](./spec/shared/client_initializer_behaviour.rb#L173)
2918
+ * [uses an alternate endpoint for REST clients](./spec/shared/client_initializer_behaviour.rb#L185)
2463
2919
  * with realtime_host option
2464
- * PENDING: *[uses an alternate endpoint for Realtime clients](./spec/shared/client_initializer_behaviour.rb#L182)*
2920
+ * PENDING: *[uses an alternate endpoint for Realtime clients](./spec/shared/client_initializer_behaviour.rb#L194)*
2465
2921
  * with port option and non-TLS connections
2466
- * [uses the custom port for non-TLS requests](./spec/shared/client_initializer_behaviour.rb#L191)
2922
+ * [uses the custom port for non-TLS requests](./spec/shared/client_initializer_behaviour.rb#L203)
2467
2923
  * with tls_port option and a TLS connection
2468
- * [uses the custom port for TLS requests](./spec/shared/client_initializer_behaviour.rb#L199)
2924
+ * [uses the custom port for TLS requests](./spec/shared/client_initializer_behaviour.rb#L211)
2469
2925
  * tls
2470
- * [defaults to TLS](./spec/shared/client_initializer_behaviour.rb#L218)
2926
+ * [defaults to TLS](./spec/shared/client_initializer_behaviour.rb#L234)
2471
2927
  * set to false
2472
- * [uses plain text](./spec/shared/client_initializer_behaviour.rb#L209)
2473
- * [uses HTTP](./spec/shared/client_initializer_behaviour.rb#L213)
2928
+ * [uses plain text](./spec/shared/client_initializer_behaviour.rb#L225)
2929
+ * [uses HTTP](./spec/shared/client_initializer_behaviour.rb#L229)
2474
2930
  * logger
2475
2931
  * default
2476
- * [uses Ruby Logger](./spec/shared/client_initializer_behaviour.rb#L225)
2477
- * [specifies Logger::WARN log level](./spec/shared/client_initializer_behaviour.rb#L229)
2932
+ * [uses Ruby Logger](./spec/shared/client_initializer_behaviour.rb#L245)
2933
+ * [specifies Logger::WARN log level](./spec/shared/client_initializer_behaviour.rb#L249)
2478
2934
  * with log_level :none
2479
- * [silences all logging with a NilLogger](./spec/shared/client_initializer_behaviour.rb#L237)
2935
+ * [silences all logging with a NilLogger](./spec/shared/client_initializer_behaviour.rb#L257)
2480
2936
  * with custom logger and log_level
2481
- * [uses the custom logger](./spec/shared/client_initializer_behaviour.rb#L255)
2482
- * [sets the custom log level](./spec/shared/client_initializer_behaviour.rb#L259)
2937
+ * [uses the custom logger](./spec/shared/client_initializer_behaviour.rb#L275)
2938
+ * [sets the custom log level](./spec/shared/client_initializer_behaviour.rb#L279)
2483
2939
  * delegators
2484
- * [delegates :client_id to .auth](./spec/shared/client_initializer_behaviour.rb#L269)
2485
- * [delegates :auth_options to .auth](./spec/shared/client_initializer_behaviour.rb#L274)
2940
+ * [delegates :client_id to .auth](./spec/shared/client_initializer_behaviour.rb#L293)
2941
+ * [delegates :auth_options to .auth](./spec/shared/client_initializer_behaviour.rb#L298)
2486
2942
  * initializer options
2487
2943
  * TLS
2488
2944
  * disabled
@@ -2505,22 +2961,25 @@ _(see [spec/unit/rest/rest_spec.rb](./spec/unit/rest/rest_spec.rb))_
2505
2961
  _(see [spec/unit/util/crypto_spec.rb](./spec/unit/util/crypto_spec.rb))_
2506
2962
  * defaults
2507
2963
  * [match other client libraries](./spec/unit/util/crypto_spec.rb#L18)
2964
+ * get_default_params
2965
+ * [uses the defaults and generates a key if not provided](./spec/unit/util/crypto_spec.rb#L25)
2966
+ * [uses the defaults and sets the key size when key is provided](./spec/unit/util/crypto_spec.rb#L32)
2508
2967
  * encrypts & decrypt
2509
- * [#encrypt encrypts a string](./spec/unit/util/crypto_spec.rb#L28)
2510
- * [#decrypt decrypts a string](./spec/unit/util/crypto_spec.rb#L33)
2968
+ * [#encrypt encrypts a string](./spec/unit/util/crypto_spec.rb#L46)
2969
+ * [#decrypt decrypts a string](./spec/unit/util/crypto_spec.rb#L51)
2511
2970
  * encrypting an empty string
2512
- * [raises an ArgumentError](./spec/unit/util/crypto_spec.rb#L42)
2971
+ * [raises an ArgumentError](./spec/unit/util/crypto_spec.rb#L60)
2513
2972
  * using shared client lib fixture data
2514
2973
  * with AES-128-CBC
2515
2974
  * behaves like an Ably encrypter and decrypter
2516
2975
  * text payload
2517
- * [encrypts exactly the same binary data as other client libraries](./spec/unit/util/crypto_spec.rb#L65)
2518
- * [decrypts exactly the same binary data as other client libraries](./spec/unit/util/crypto_spec.rb#L69)
2976
+ * [encrypts exactly the same binary data as other client libraries](./spec/unit/util/crypto_spec.rb#L83)
2977
+ * [decrypts exactly the same binary data as other client libraries](./spec/unit/util/crypto_spec.rb#L87)
2519
2978
  * with AES-256-CBC
2520
2979
  * behaves like an Ably encrypter and decrypter
2521
2980
  * text payload
2522
- * [encrypts exactly the same binary data as other client libraries](./spec/unit/util/crypto_spec.rb#L65)
2523
- * [decrypts exactly the same binary data as other client libraries](./spec/unit/util/crypto_spec.rb#L69)
2981
+ * [encrypts exactly the same binary data as other client libraries](./spec/unit/util/crypto_spec.rb#L83)
2982
+ * [decrypts exactly the same binary data as other client libraries](./spec/unit/util/crypto_spec.rb#L87)
2524
2983
 
2525
2984
  ### Ably::Util::PubSub
2526
2985
  _(see [spec/unit/util/pub_sub_spec.rb](./spec/unit/util/pub_sub_spec.rb))_
@@ -2536,6 +2995,6 @@ _(see [spec/unit/util/pub_sub_spec.rb](./spec/unit/util/pub_sub_spec.rb))_
2536
2995
 
2537
2996
  ## Test summary
2538
2997
 
2539
- * Passing tests: 1244
2540
- * Pending tests: 13
2998
+ * Passing tests: 1467
2999
+ * Pending tests: 6
2541
3000
  * Failing tests: 0