Skip to content

Commit e4434d1

Browse files
authored
Merge pull request #121 from pusher/include-cluster-in-readme
Include cluster in README examples
2 parents adf0498 + 7fc9a93 commit e4434d1

File tree

1 file changed

+14
-27
lines changed

1 file changed

+14
-27
lines changed

README.md

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,35 +25,27 @@ Creating a new Pusher `client` can be done as follows.
2525

2626
``` ruby
2727
pusher_client = Pusher::Client.new(
28-
app_id: 'your-pusher-app-id',
29-
key: 'your-pusher-key',
30-
secret: 'your-pusher-secret'
28+
app_id: 'your-app-id',
29+
key: 'your-app-key',
30+
secret: 'your-app-secret',
31+
cluster: 'your-app-cluster',
3132
)
3233
```
34+
The cluster value will set the `host` to `api-<cluster>.pusher.com`.
3335

3436
If you want to set a custom `host` value for your client then you can do so when instantiating a Pusher client like so:
3537

3638
``` ruby
3739
pusher_client = Pusher::Client.new(
38-
app_id: 'your-pusher-app-id',
39-
key: 'your-pusher-key',
40-
secret: 'your-pusher-secret',
41-
host: 'your-pusher-host'
40+
app_id: 'your-app-id',
41+
key: 'your-app-key',
42+
secret: 'your-app-secret',
43+
host: 'your-app-host'
4244
)
4345
```
4446

45-
If you created your app in a different cluster to the default cluster, you must pass the `cluster` option as follows:
47+
If you pass both `host` and `cluster` options, the `host` will take precendence and `cluster` will be ignored.
4648

47-
``` ruby
48-
pusher_client = Pusher::Client.new(
49-
app_id: 'your-pusher-app-id',
50-
key: 'your-pusher-key',
51-
secret: 'your-pusher-secret',
52-
cluster: 'your-app-cluster'
53-
)
54-
```
55-
56-
This will set the `host` to `api-<cluster>.pusher.com`. If you pass both `host` and `cluster` options, the `host` will take precendence and `cluster` will be ignored.
5749

5850
Finally, if you have the configuration set in an `PUSHER_URL` environment
5951
variable, you can use:
@@ -67,18 +59,13 @@ pusher_client = Pusher::Client.from_env
6759
Configuring Pusher can also be done globally on the Pusher class.
6860

6961
``` ruby
70-
Pusher.app_id = 'your-pusher-app-id'
71-
Pusher.key = 'your-pusher-key'
72-
Pusher.secret = 'your-pusher-secret'
73-
```
74-
75-
If you created your app in a different cluster to the default cluster, you must set it as follows:
76-
77-
``` ruby
62+
Pusher.app_id = 'your-app-id'
63+
Pusher.key = 'your-app-key'
64+
Pusher.secret = 'your-app-secret'
7865
Pusher.cluster = 'your-app-cluster'
7966
```
8067

81-
Global configuration will automatically be set from the `PUSHER_URL` environment variable if it exists. This should be in the form `http://KEY:SECRET@api.pusherapp.com/apps/APP_ID`. On Heroku this environment variable will already be set.
68+
Global configuration will automatically be set from the `PUSHER_URL` environment variable if it exists. This should be in the form `http://KEY:SECRET@HOST/apps/APP_ID`. On Heroku this environment variable will already be set.
8269

8370
If you need to make requests via a HTTP proxy then it can be configured
8471

0 commit comments

Comments
 (0)