You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/api/realtime-sdk.textile
+47-28Lines changed: 47 additions & 28 deletions
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,6 @@ title: Constructor
3
3
meta_description: "Realtime Client Library SDK API reference section for the constructor object."
4
4
meta_keywords: "Ably, Ably realtime, API Reference, Realtime SDK, constructor, instantiate"
5
5
section: api
6
-
index: 1
7
6
languages:
8
7
- javascript
9
8
- nodejs
@@ -13,37 +12,12 @@ languages:
13
12
- objc
14
13
- csharp
15
14
- flutter
16
-
jump_to:
17
-
Constructor object:
18
-
- constructor
19
-
Attributes:
20
-
- auth
21
-
- channels
22
-
- client_id#client-id
23
-
- connection
24
-
- rest_client#rest-client
25
-
Methods:
26
-
- connect
27
-
- close
28
-
- stats
29
-
- time
30
-
- request
31
-
Related Types:
32
-
- ClientOptions#client-options
33
-
- stats#stats-type
34
-
- HttpPaginatedResponse#http-paginated-response
35
15
redirect_from:
36
16
- /docs/api/versions/v1.1/realtime-sdk
37
17
- /docs/api/versions/v1.0/realtime-sdk
38
18
- /docs/api/versions/v0.8/realtime-sdk
39
19
---
40
20
41
-
blang[javascript,nodejs].
42
-
43
-
<aside data-type='note'>
44
-
<p>This API reference is for version 1.2 of the JavaScript SDK. Version 2.0 references are "available in TypeDoc.":https://ably.com/docs/sdk/js/v2.0/</p>
45
-
</aside>
46
-
47
21
h2(#constructor). Constructor
48
22
49
23
The Ably Realtime library constructor is overloaded allowing it to be instantiated using a "@ClientOptions@":#client-options object, or more simply using a string containing an "API key":/docs/auth/basic or "Token":/docs/auth/token, as shown below:
Obtains the time from the Ably service as <span lang="ruby">a @Time@ object</span><span lang="csharp">a @DateTimeOffset@ object</span><span lang="default">milliseconds since epoch</span>. (Clients that do not have access to a sufficiently well maintained time source and wish to issue Ably "TokenRequests":/docs/api/realtime-sdk/authentication#token-request with a more accurate timestamp should use the @queryTime@ "clientOptions":#client-options instead of this method).
217
193
218
-
blang[jsall,objc,swift].
194
+
blang[jsall].
195
+
h4. Returns
196
+
197
+
Returns a promise. On success, the promise is fulfilled with the time as milliseconds since the Unix epoch. On failure, the promise is rejected with an "@ErrorInfo@":/api/realtime-sdk/types#error-info object.
198
+
199
+
blang[objc,swift].
219
200
h4. Callback result
220
201
221
202
On success, @time@ is a number containing the number of milliseconds since the epoch.
@@ -238,7 +219,6 @@ blang[csharp].
238
219
239
220
Failure to retrieve the Ably server time will raise an "@AblyException@":#ably-exception.
Publishes one or more "@BatchPublishSpec@":LINK objects to one or more channels, up to a maximum of 100 channels.
247
+
248
+
h4. Parameters
249
+
250
+
- spec := an object describing the messages to be batch published and to which channels<br>__Type: "@BatchPublishSpec@":LINK__
251
+
- specs := an array of objects describing the messages to be batch published and to which channels<br>__Type: "@BatchPublishSpec@[]":LINK__
252
+
253
+
h4. Returns
254
+
255
+
Returns a promise. On success, the promise is fulfilled with a "@BatchResult@":/LINK object, or an array of @BatchResult@ objects, containing information about the result of the batch publish operation for each channel. The successful results of specific channels are returned as "@BatchPublishSuccessResult@":/LINK objects, whilst failures are "@BatchPublishFailureResult@":/LINK objects. If an array of @BatchResult@ objects are returned, they are in the same order as the provided "@BatchPublishSpec@":/LINK. On failure, the promise is rejected with an "@ErrorInfo@":/api/realtime-sdk/types#error-info object.
Retrieves the presence state for one or more channels, up to a maximum of 100 channels. Presence state includes the "@clientId@":#client-options of members and their current "@PresenceAction@":/api/realtime-sdk/presence#presence-action
263
+
264
+
h4. Parameters
265
+
266
+
- channels := an array of one or more channel names, up to a maximum of 100 channels<br>__Type: @String[]@__
267
+
268
+
h4. Returns
269
+
270
+
Returns a promise. On success, the promise is fulfilled with a "@BatchResult@":/LINK object containing information about the result of the batch presence request for each channel. The successful results of specific channels are returned as "@BatchPresenceSuccessResult@":/LINK objects, whilst failures are "@BatchPresenceFailureResult@":/LINK objects. On failure, the promise is rejected with an "@ErrorInfo@":/api/realtime-sdk/types#error-info object.
<p>This API reference is for version 1.2 of the JavaScript SDK. Version 2.0 references are "available in TypeDoc.":https://ably.com/docs/sdk/js/v2.0/</p>
21
-
</aside>
22
-
23
11
h2(#types). Types
24
12
25
13
The payload of metadata events for channels is the "@ChannelDetails@":#channel-details type which contains the @channelId@ and other static information about the channel, plus a @status@ containing a "@ChannelStatus@":#channel-status instance which contains information about the current state of the channel.
0 commit comments