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