Skip to content

Commit

Permalink
docs: add Proxy example
Browse files Browse the repository at this point in the history
Fixes #194
  • Loading branch information
wolfy1339 committed Aug 22, 2024
1 parent 755242f commit 53563af
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,25 @@ const events = smee.start()
// Stop forwarding events
events.close()
```

#### Proxy Servers

By default, the `SmeeClient` API client does not make use of the standard proxy server environment variables. To add support for proxy servers you will need to provide an https client that supports them such as [`undici.ProxyAgent()`](https://undici.nodejs.org/#/docs/api/ProxyAgent).

For example, this would use a `ProxyAgent` to make requests through a proxy server:

```js
const { fetch: undiciFetch, ProxyAgent } = require('undici');
const SmeeClient = require('smee-client');

const myFetch = (url, options) => {
return undiciFetch(url, {
...options,
dispatcher: new ProxyAgent(<your_proxy_url>)
})
};

const smee = new SmeeClient({
fetch: myFetch
});
```

0 comments on commit 53563af

Please sign in to comment.