Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
jajbshjahavahh
GitHub Repository: jajbshjahavahh/Gojo-Satoru
Path: blob/master/node_modules/@adiwajshing/baileys/lib/Socket/socket.d_1.ts
2593 views
1
/// <reference types="node" />
2
import WebSocket from 'ws';
3
import { AuthenticationCreds, BaileysEventEmitter, 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: initialAuthState, printQRInTerminal, defaultQueryTimeoutMs }: SocketConfig) => {
12
type: "md";
13
ws: WebSocket;
14
ev: BaileysEventEmitter;
15
authState: {
16
creds: AuthenticationCreds;
17
keys: import("../Types").SignalKeyStoreWithTransaction;
18
};
19
readonly user: import("../Types").Contact;
20
assertingPreKeys: (range: number, execute: (keys: {
21
[_: number]: any;
22
}) => Promise<void>) => Promise<void>;
23
generateMessageTag: () => string;
24
query: (node: BinaryNode, timeoutMs?: number) => Promise<BinaryNode>;
25
waitForMessage: (msgId: string, timeoutMs?: number) => Promise<any>;
26
waitForSocketOpen: () => Promise<void>;
27
sendRawMessage: (data: Buffer | Uint8Array) => Promise<void>;
28
sendNode: (node: BinaryNode) => Promise<void>;
29
logout: () => Promise<void>;
30
end: (error: Error | undefined) => void;
31
/** Waits for the connection to WA to reach a state */
32
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean, timeoutMs?: number) => Promise<void>;
33
};
34
export declare type Socket = ReturnType<typeof makeSocket>;
35
36