Skip to content

Commit ca1ec69

Browse files
authored
Merge pull request #3393 from ably/pusher-adapter-readd-dropped-info
docs(pusher): re-add dropped server library, interoperability, and count details
2 parents 7dbb610 + 5bfd794 commit ca1ec69

1 file changed

Lines changed: 41 additions & 2 deletions

File tree

src/pages/docs/protocols/pusher.mdx

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,14 @@ const pusher = new Pusher('appId.keyId', {
6363
httpHost: 'main.pusher.ably.net',
6464
disableStats: true,
6565
forceTls: true,
66-
cluster: 'eu'
66+
cluster: 'eu',
67+
authEndpoint: '...',
6768
});
6869
```
6970
</Code>
7071

7172
<Aside data-type='note'>
72-
You should only use your [Ably API key name](/docs/auth#format), not the full API key. This includes everything before the colon `:` in your API key.
73+
You should only use your [Ably API key name](/docs/auth#format), not the full API key. This is the part before the colon `:`.
7374
</Aside>
7475

7576
| Option | Description |
@@ -79,9 +80,40 @@ You should only use your [Ably API key name](/docs/auth#format), not the full AP
7980
| disableStats | Disable the collection of stats in Pusher. |
8081
| forceTls | Force the connection to use TLS. This isn't required but strongly recommended by Ably to avoid sending private keys over a plain text connection. |
8182
| cluster | Set this to any value as it is required by Pusher. It has no impact on the Ably Pusher endpoint as Ably will use the closest data center available to the client. |
83+
| authEndpoint | The address of your [auth server](#configure-rest), if you are using one. |
8284

8385
You can also add any other Pusher options that you normally use.
8486

87+
### Configure a Pusher server library <a id="configure-rest"/>
88+
89+
If doing anything other than subscribing to public channels, such as authorizing a client to access a private or presence channel or publishing from your backend, you will need to configure a Pusher server-side library to point at Ably. Using Ruby as an example:
90+
91+
<Code>
92+
```ruby
93+
Pusher::Client.new(
94+
app_id: 'appId',
95+
key: 'appId.keyId',
96+
secret: 'keySecret',
97+
host: 'main.pusher.ably.net',
98+
use_tls: true
99+
)
100+
```
101+
</Code>
102+
103+
All other Pusher server libraries are configured in a similar way.
104+
105+
| Option | Description |
106+
|--------|-------------|
107+
| app_id | Your Ably app ID. This is the part of the API key before the first dot. |
108+
| key | Your Ably API [key name](/docs/auth#format). This is everything before the colon `:` in your API key. |
109+
| secret | The secret portion of your API key. This is everything after the colon `:` in your API key. |
110+
| host | Set the host to point to Ably: `main.pusher.ably.net`. |
111+
| use_tls | Use TLS for the connection. This isn't required but is strongly recommended to avoid sending your API key secret over a plain text connection. |
112+
113+
<Aside data-type='note'>
114+
The adapter uses the standard Ably service behind the scenes, so you can use Pusher and Ably SDKs side-by-side against the same channels. For example, you can publish and subscribe using Pusher libraries, but use the [Ably REST API](/docs/api/rest-api) to retrieve [message history](/docs/storage-history/history), which isn't available through the Pusher libraries. Bear in mind [channel name mapping](#mapping) when mixing libraries.
115+
</Aside>
116+
85117
## Channel mapping <a id="mapping"/>
86118

87119
Ably and Pusher have different naming restrictions for channel names, and use namespaces differently.
@@ -105,3 +137,10 @@ The following are some example channel name mappings:
105137
| foo;bar | public:foo:bar |
106138
| private-ablyroot-foo | foo |
107139
| private-ablyroot-foo;bar | foo:bar |
140+
141+
## User and subscriber count <a id="counts"/>
142+
143+
Both user count and subscriber count currently only work on presence channels.
144+
145+
* User count returns the size of the presence set once it has been made unique by `clientId`.
146+
* Subscriber count returns the raw size of the presence set.

0 commit comments

Comments
 (0)