mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
feat: add desktop + full history sync opts
This commit is contained in:
57
README.md
57
README.md
@@ -103,35 +103,44 @@ The entire `SocketConfig` structure is mentioned here with default values:
|
||||
``` ts
|
||||
type SocketConfig = {
|
||||
/** provide an auth state object to maintain the auth state */
|
||||
auth?: AuthenticationState
|
||||
/** the WS url to connect to WA */
|
||||
waWebSocketUrl: string | URL
|
||||
/** Fails the connection if the connection times out in this time interval or no data is received */
|
||||
connectTimeoutMs: number
|
||||
/** Default timeout for queries, undefined for no timeout */
|
||||
defaultQueryTimeoutMs: number | undefined
|
||||
/** ping-pong interval for WS connection */
|
||||
keepAliveIntervalMs: number
|
||||
/** proxy agent */
|
||||
agent?: Agent
|
||||
/** pino logger */
|
||||
logger: Logger
|
||||
/** version to connect with */
|
||||
version: WAVersion
|
||||
/** override browser config */
|
||||
browser: WABrowserDescription
|
||||
/** agent used for fetch requests -- uploading/downloading media */
|
||||
fetchAgent?: Agent
|
||||
/** should the QR be printed in the terminal */
|
||||
printQRInTerminal: boolean
|
||||
/**
|
||||
* fetch a message from your store
|
||||
* implement this so that messages that failed to send (solves the "this message can take a while" issue) can be retried
|
||||
auth: AuthenticationState
|
||||
/** By default true, should history messages be downloaded and processed */
|
||||
downloadHistory: boolean
|
||||
/** transaction capability options for SignalKeyStore */
|
||||
transactionOpts: TransactionCapabilityOptions
|
||||
/** provide a cache to store a user's device list */
|
||||
userDevicesCache?: NodeCache
|
||||
/** marks the client as online whenever the socket successfully connects */
|
||||
markOnlineOnConnect: boolean
|
||||
/**
|
||||
* map to store the retry counts for failed messages;
|
||||
* used to determine whether to retry a message or not */
|
||||
msgRetryCounterMap?: MessageRetryMap
|
||||
/** width for link preview images */
|
||||
linkPreviewImageThumbnailWidth: number
|
||||
/** Should Baileys ask the phone for full history, will be received async */
|
||||
syncFullHistory: boolean
|
||||
/**
|
||||
* fetch a message from your store
|
||||
* implement this so that messages failed to send (solves the "this message can take a while" issue) can be retried
|
||||
* */
|
||||
getMessage: (key: proto.IMessageKey) => Promise<proto.IMessage | undefined>
|
||||
}
|
||||
```
|
||||
|
||||
### Emulating the Desktop app instead of the web
|
||||
|
||||
1. Baileys, by default, emulates a chrome web session
|
||||
2. If you'd like to emulate a desktop connection (and receive more message history), add this to your Socket config:
|
||||
``` ts
|
||||
const conn = makeWASocket({
|
||||
...otherOpts,
|
||||
// can use Windows, Ubuntu here too
|
||||
browser: Browsers.macOS('Desktop'),
|
||||
syncFullHistory: true
|
||||
})
|
||||
```
|
||||
|
||||
## 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