mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
added proxy support
This commit is contained in:
13
README.md
13
README.md
@@ -51,7 +51,6 @@ async function connectToWhatsApp () {
|
||||
const unread = await conn.loadAllUnreadMessages ()
|
||||
console.log ("you have " + unread.length + " unread messages")
|
||||
}
|
||||
|
||||
// run in main file
|
||||
connectToWhatsApp ()
|
||||
.catch (err => console.log("unexpected error: " + err) ) // catch any errors
|
||||
@@ -69,6 +68,18 @@ Do note, the `chats` object returned is now a [KeyedDB](https://github.com/adiwa
|
||||
- Most applications require pagination of chats (Use `chats.paginated()`)
|
||||
- Most applications require **O(1)** access to chats via the chat ID. (Use `chats.get(jid)` with `KeyedDB`)
|
||||
|
||||
## Connecting via an HTTPS proxy
|
||||
|
||||
``` ts
|
||||
import { WAConnection, ProxyAgent } from '@adiwajshing/baileys'
|
||||
|
||||
const conn = new WAConnecion ()
|
||||
conn.connectOptions.agent = ProxyAgent ('http://some-host:1234')
|
||||
|
||||
await conn.connect ()
|
||||
console.log ("oh hello " + conn.user.name + "! You connected via a proxy")
|
||||
```
|
||||
|
||||
## Saving & Restoring Sessions
|
||||
|
||||
You obviously don't want to keep scanning the QR code every time you want to connect.
|
||||
|
||||
Reference in New Issue
Block a user