Skip to content

Fix: Replace proxy section with agent #208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,23 @@ variable to such URL, if you have the Pusher addon installed.

There are a few additional options that can be used in all above methods:

```javascript
const Pusher = require("pusher")
- To configure a proxy, use [`https://www.npmjs.com/package/https-proxy-agent`](https://www.npmjs.com/package/https-proxy-agent) or similar:

const pusher = new Pusher({
// you can set other options in any of the 3 ways described above
proxy: "HTTP_PROXY_URL", // optional, URL to proxy the requests through
timeout: TIMEOUT, // optional, timeout for all requests in milliseconds
keepAlive: KEEP_ALIVE, // optional, enables keep-alive, defaults to false
```js
const pusher = new Pusher.forURL(process.env.PUSHER_URL, {
agent: new HttpsProxyAgent("http://localhost:8321"),
})
```

- To configure keep alive:

```js
const pusher = new Pusher.forURL(process.env.PUSHER_URL, {
agent: new https.Agent({ keepAlive: true }),
})
```


## Usage

### Callbacks and error handling
Expand Down