Skip to content

Commit

Permalink
Merge pull request #1 from pusher/master
Browse files Browse the repository at this point in the history
Sync fork with upstream
  • Loading branch information
BenRoss92 authored Oct 2, 2017
2 parents adf0498 + a4b3b02 commit 3b59485
Showing 1 changed file with 15 additions and 31 deletions.
46 changes: 15 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,35 +25,27 @@ Creating a new Pusher `client` can be done as follows.

``` ruby
pusher_client = Pusher::Client.new(
app_id: 'your-pusher-app-id',
key: 'your-pusher-key',
secret: 'your-pusher-secret'
app_id: 'your-app-id',
key: 'your-app-key',
secret: 'your-app-secret',
cluster: 'your-app-cluster',
)
```
The cluster value will set the `host` to `api-<cluster>.pusher.com`.

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

``` ruby
pusher_client = Pusher::Client.new(
app_id: 'your-pusher-app-id',
key: 'your-pusher-key',
secret: 'your-pusher-secret',
host: 'your-pusher-host'
app_id: 'your-app-id',
key: 'your-app-key',
secret: 'your-app-secret',
host: 'your-app-host'
)
```

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

``` ruby
pusher_client = Pusher::Client.new(
app_id: 'your-pusher-app-id',
key: 'your-pusher-key',
secret: 'your-pusher-secret',
cluster: 'your-app-cluster'
)
```

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.

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

``` ruby
Pusher.app_id = 'your-pusher-app-id'
Pusher.key = 'your-pusher-key'
Pusher.secret = 'your-pusher-secret'
```

If you created your app in a different cluster to the default cluster, you must set it as follows:

``` ruby
Pusher.app_id = 'your-app-id'
Pusher.key = 'your-app-key'
Pusher.secret = 'your-app-secret'
Pusher.cluster = 'your-app-cluster'
```

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.
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.

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

Expand Down Expand Up @@ -287,8 +274,6 @@ pusher.notify(["my-favourite-interest"], data)

Push notification requests, once submitted to the service are executed asynchronously. To make reporting errors easier, you can supply a `webhook_url` field in the body of the request. This will be used by the service to send a webhook to the supplied URL if there are errors.

You may also supply a `webhook_level` field in the body, which can either be INFO or DEBUG. It defaults to INFO - where INFO only reports customer facing errors, while DEBUG reports all errors.

For example:

```ruby
Expand All @@ -306,8 +291,7 @@ data = {
icon: "icon"
}
},
webhook_url: "http://yolo.com",
webhook_level: "INFO"
webhook_url: "http://yolo.com"
}
```

Expand Down

0 comments on commit 3b59485

Please sign in to comment.