Path: blob/master/node_modules/@adiwajshing/baileys/lib/Socket/socket.d.ts
1129 views
/// <reference types="node" />1import WebSocket from 'ws';2import { 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: authState, printQRInTerminal, defaultQueryTimeoutMs, syncFullHistory, transactionOpts, qrTimeout }: SocketConfig) => {11type: "md";12ws: WebSocket;13ev: import("../Types").BaileysEventEmitter & {14process(handler: (events: Partial<import("../Types").BaileysEventMap<import("../Types").AuthenticationCreds>>) => void | Promise<void>): () => void;15buffer(): boolean;16createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>;17flush(): Promise<void>;18processInBuffer(task: Promise<any>): any;19};20authState: {21creds: import("../Types").AuthenticationCreds;22keys: import("../Types").SignalKeyStoreWithTransaction;23};24readonly user: import("../Types").Contact | undefined;25generateMessageTag: () => string;26query: (node: BinaryNode, timeoutMs?: number) => Promise<BinaryNode>;27waitForMessage: (msgId: string, timeoutMs?: number | undefined) => Promise<any>;28waitForSocketOpen: () => Promise<void>;29sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;30sendNode: (frame: BinaryNode) => Promise<void>;31logout: () => Promise<void>;32end: (error: Error | undefined) => void;33onUnexpectedError: (error: Error, msg: string) => void;34uploadPreKeys: (count?: number) => Promise<void>;35/** Waits for the connection to WA to reach a state */36waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;37};38export declare type Socket = ReturnType<typeof makeSocket>;394041