UNPKG

@whiskeysockets/baileys

Version:

A WebSockets library for interacting with WhatsApp Web

43 lines (42 loc) 2.07 kB
import { Boom } from '@hapi/boom'; import { SocketConfig } from '../Types'; import { BinaryNode } from '../WABinary'; import { WebSocketClient } from './Client'; /** * Connects to WA servers and performs: * - simple queries (no retry mechanism, wait for connection establishment) * - listen to messages and emit events * - query phone connection */ export declare const makeSocket: (config: SocketConfig) => { type: "md"; ws: WebSocketClient; ev: import("../Types").BaileysEventEmitter & { process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void); buffer(): void; createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>); flush(force?: boolean): boolean; isBuffering(): boolean; }; authState: { creds: import("../Types").AuthenticationCreds; keys: import("../Types").SignalKeyStoreWithTransaction; }; signalRepository: import("../Types").SignalRepository; readonly user: import("../Types").Contact | undefined; generateMessageTag: () => string; query: (node: BinaryNode, timeoutMs?: number) => Promise<any>; waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<any>; waitForSocketOpen: () => Promise<void>; sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>; sendNode: (frame: BinaryNode) => Promise<void>; logout: (msg?: string) => Promise<void>; end: (error: Error | undefined) => void; onUnexpectedError: (err: Error | Boom, msg: string) => void; uploadPreKeys: (count?: number) => Promise<void>; uploadPreKeysToServerIfRequired: () => Promise<void>; requestPairingCode: (phoneNumber: string) => Promise<string>; /** Waits for the connection to WA to reach a state */ waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>; sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>; };