Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MR414N-ID
GitHub Repository: MR414N-ID/botku2
Path: blob/master/node_modules/@adiwajshing/baileys/lib/LegacySocket/socket.d.ts
1129 views
1
/// <reference types="node" />
2
import WebSocket from 'ws';
3
import { LegacySocketConfig, SocketQueryOptions, SocketSendMessageOptions, WATag } from '../Types';
4
import { BinaryNode } from '../WABinary';
5
/**
6
* Connects to WA servers and performs:
7
* - simple queries (no retry mechanism, wait for connection establishment)
8
* - listen to messages and emit events
9
* - query phone connection
10
*/
11
export declare const makeSocket: ({ waWebSocketUrl, connectTimeoutMs, phoneResponseTimeMs, logger, agent, keepAliveIntervalMs, expectResponseTimeout, }: LegacySocketConfig) => {
12
type: "legacy";
13
ws: WebSocket;
14
sendAdminTest: () => Promise<string>;
15
updateKeys: (info: {
16
encKey: Buffer;
17
macKey: Buffer;
18
}) => {
19
encKey: Buffer;
20
macKey: Buffer;
21
};
22
waitForSocketOpen: () => Promise<void>;
23
sendNode: ({ json, binaryTag, tag, longTag }: SocketSendMessageOptions) => Promise<string>;
24
generateMessageTag: (longTag?: boolean) => string;
25
waitForMessage: (tag: string, requiresPhoneConnection: boolean, timeoutMs?: number) => {
26
promise: Promise<any>;
27
cancelToken: () => void;
28
};
29
query: ({ json, timeoutMs, expect200, tag, longTag, binaryTag, requiresPhoneConnection }: SocketQueryOptions) => Promise<any>;
30
/** Generic function for action, set queries */
31
setQuery: (nodes: BinaryNode[], binaryTag?: WATag, tag?: string) => Promise<{
32
status: number;
33
}>;
34
currentEpoch: () => number;
35
end: (error: Error | undefined) => void;
36
};
37
38