Skip to content

Commit 20e580e

Browse files
committed
Update docs re ably-js v2 API
1 parent a99e4db commit 20e580e

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ To instantiate the Spaces SDK, create an [Ably client](https://ably.com/docs/get
7676
import Spaces from '@ably/spaces';
7777
import { Realtime } from 'ably';
7878

79-
const client = new Realtime.Promise({ key: "<API-key>", clientId: "<client-ID>" });
79+
const client = new Realtime({ key: "<API-key>", clientId: "<client-ID>" });
8080
const spaces = new Spaces(client);
8181
```
8282
You can use [basic authentication](https://ably.com/docs/auth/basic) i.e. the API Key directly for testing purposes, however it is strongly recommended that you use [token authentication](https://ably.com/docs/auth/token) in production environments.
@@ -95,7 +95,7 @@ You can also use Spaces with a CDN, such as [unpkg](https://www.unpkg.com/):
9595
After this, instantiate the SDK in the same way as in the NPM option above:
9696

9797
```ts
98-
const client = new Ably.Realtime.Promise({ key: "<API-key>", clientId: "<client-ID>" });
98+
const client = new Ably.Realtime({ key: "<API-key>", clientId: "<client-ID>" });
9999
const spaces = new Spaces(client);
100100
```
101101

docs/connection-and-channel-management.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This document describes how to access a connection and channels on Spaces, and w
99
When initializing the Spaces SDK, an Ably client is passed as a required argument:
1010

1111
```ts
12-
const client = new Realtime.Promise({ key: "<API-key>", clientId: "<client-ID>" });
12+
const client = new Realtime({ key: "<API-key>", clientId: "<client-ID>" });
1313
const spaces = new Spaces(client);
1414
```
1515

@@ -50,4 +50,4 @@ mySpace.cursors.subscribe('update', () => {});
5050

5151
- [Channels](https://ably.com/docs/channels)
5252
- [Channel states](https://ably.com/docs/channels#states)
53-
- [Handle channel failure](https://ably.com/docs/channels#failure)
53+
- [Handle channel failure](https://ably.com/docs/channels#failure)

docs/react.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import { Realtime } from "ably";
4343
import Spaces from "@ably/spaces";
4444
import { SpacesProvider, SpaceProvider } from "@ably/spaces/react";
4545

46-
const ably = new Realtime.Promise({ key: "your-ably-api-key", clientId: 'me' });
46+
const ably = new Realtime({ key: "your-ably-api-key", clientId: 'me' });
4747
const spaces = new Spaces(ably);
4848

4949
root.render(

docs/usage.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@ You can also use Spaces with a CDN like [unpkg](https://www.unpkg.com/):
3939

4040
> **Note**
4141
>
42-
> If you do this, then replace the call to `new Realtime.Promise` in the next section with `new Ably.Realtime.Promise`.
42+
> If you do this, then replace the call to `new Realtime` in the next section with `new Ably.Realtime`.
4343
4444
## Authentication and instantiation
4545

46-
Spaces use an [Ably promise-based realtime client](https://github.com/ably/ably-js#using-the-async-api-style). You can pass an Ably client directly to the spaces constructor.
46+
You can pass an Ably client directly to the spaces constructor.
4747

4848
The Ably client instantiation accepts client options. You will need at minimum an [Ably API key](#ably-api-key) and a [clientId](https://ably.com/docs/auth/identified-clients?lang=javascripts). A clientId represents an identity of an connection. In most cases this will something like the id of a user:
4949

5050
```ts
51-
import { Realtime } from 'ably/promise';
51+
import { Realtime } from 'ably';
5252
import Spaces from '@ably/spaces';
5353

54-
const client = new Realtime.Promise({ key: "<API-key>", clientId: "<client-ID>" });
54+
const client = new Realtime({ key: "<API-key>", clientId: "<client-ID>" });
5555
const spaces = new Spaces(client);
5656
```
5757

src/Spaces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Spaces {
3636
readonly version = VERSION;
3737

3838
/**
39-
* Create a new instance of the Spaces SDK by passing an instance of the [Ably promise-based realtime client](https://ably.com/docs/getting-started/setup). A [`clientId`](https://ably.com/docs/auth/identified-clients) is required.
39+
* Create a new instance of the Spaces SDK by passing an instance of the [Ably realtime client](https://ably.com/docs/getting-started/setup). A [`clientId`](https://ably.com/docs/auth/identified-clients) is required.
4040
*
4141
* An Ably API key is needed to authenticate. [Basic authentication](https://ably.com/docs/auth/basic) may be used for convenience, however Ably strongly recommends you use [token authentication](https://ably.com/docs/auth/token) in a production environment.
4242
*

0 commit comments

Comments
 (0)