Path: blob/master/node_modules/@adiwajshing/baileys/lib/Socket/socket.d_1.ts
2593 views
/// <reference types="node" />1import WebSocket from 'ws';2import { AuthenticationCreds, BaileysEventEmitter, SocketConfig } from '../Types';3import { BinaryNode } from '../WABinary';4/**5* Connects to WA servers and performs:6* - simple queries (no retry mechanism, wait for connection establishment)7* - listen to messages and emit events8* - query phone connection9*/10export declare const makeSocket: ({ waWebSocketUrl, connectTimeoutMs, logger, agent, keepAliveIntervalMs, version, browser, auth: initialAuthState, printQRInTerminal, defaultQueryTimeoutMs }: SocketConfig) => {11type: "md";12ws: WebSocket;13ev: BaileysEventEmitter;14authState: {15creds: AuthenticationCreds;16keys: import("../Types").SignalKeyStoreWithTransaction;17};18readonly user: import("../Types").Contact;19assertingPreKeys: (range: number, execute: (keys: {20[_: number]: any;21}) => Promise<void>) => Promise<void>;22generateMessageTag: () => string;23query: (node: BinaryNode, timeoutMs?: number) => Promise<BinaryNode>;24waitForMessage: (msgId: string, timeoutMs?: number) => Promise<any>;25waitForSocketOpen: () => Promise<void>;26sendRawMessage: (data: Buffer | Uint8Array) => Promise<void>;27sendNode: (node: BinaryNode) => Promise<void>;28logout: () => Promise<void>;29end: (error: Error | undefined) => void;30/** Waits for the connection to WA to reach a state */31waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean, timeoutMs?: number) => Promise<void>;32};33export declare type Socket = ReturnType<typeof makeSocket>;343536