Path: blob/master/node_modules/@adiwajshing/baileys/lib/LegacySocket/socket.d.ts
1129 views
/// <reference types="node" />1import WebSocket from 'ws';2import { LegacySocketConfig, SocketQueryOptions, SocketSendMessageOptions, WATag } 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, phoneResponseTimeMs, logger, agent, keepAliveIntervalMs, expectResponseTimeout, }: LegacySocketConfig) => {11type: "legacy";12ws: WebSocket;13sendAdminTest: () => Promise<string>;14updateKeys: (info: {15encKey: Buffer;16macKey: Buffer;17}) => {18encKey: Buffer;19macKey: Buffer;20};21waitForSocketOpen: () => Promise<void>;22sendNode: ({ json, binaryTag, tag, longTag }: SocketSendMessageOptions) => Promise<string>;23generateMessageTag: (longTag?: boolean) => string;24waitForMessage: (tag: string, requiresPhoneConnection: boolean, timeoutMs?: number) => {25promise: Promise<any>;26cancelToken: () => void;27};28query: ({ json, timeoutMs, expect200, tag, longTag, binaryTag, requiresPhoneConnection }: SocketQueryOptions) => Promise<any>;29/** Generic function for action, set queries */30setQuery: (nodes: BinaryNode[], binaryTag?: WATag, tag?: string) => Promise<{31status: number;32}>;33currentEpoch: () => number;34end: (error: Error | undefined) => void;35};363738