/// /// import * as net from 'net'; import { loginServers } from '../data/index.js'; import type { LoginServer, HiRezAccount, HashedCredentials } from '../interfaces/index.js'; import { Buffer } from './Buffer.js'; import { DecoderOptions } from './Decoder.js'; interface LoginServerConnectionCallbackMap { connect: Function[]; disconnect: Function[]; send: Function[]; receive: Function[]; } interface LoginServerConnectionMessage { buffer: Uint8Array; } interface LoginServerConnectionOptions { authenticate?: boolean; decoder?: DecoderOptions; } export declare class LoginServerConnection { _options: LoginServerConnectionOptions; _isConnected: boolean; _serverKey: "hirez" | "community" | undefined; _serverInstance: LoginServer; _credentials: HashedCredentials | undefined; _authProgress: { initial: boolean; confirmation: boolean; }; _socket: net.Socket; _isReceivingStream: boolean; _streamBuffer: Buffer; _timeToIdle: number; _idleTimers: NodeJS.Timeout[]; _messageQueue: LoginServerConnectionMessage[]; _messageId: number; _callbacks: LoginServerConnectionCallbackMap; constructor(server: keyof typeof loginServers | LoginServer, credentials: HashedCredentials, options?: LoginServerConnectionOptions); /** * Attach a callback function to any of the available connection events. (Multiple callbacks can be attached to a single event). * @param event The event to listen for. (Eg: `connect`, `receive`, etc). * @param callback Callback function to attach to the event. * @returns `true` if the callback was successfully attached, `false` if not. */ on(event: keyof LoginServerConnectionCallbackMap, callback: Function): boolean; /** * Establish a live connection to the Login Server. */ connect(): Promise; /** * Disconnect from the login server. */ disconnect(): Promise; /** * Immediately send a message to the connected server, bypassing the message queue. * @param message The message to send. */ send(message: LoginServerConnectionMessage): Promise; /** * Add a message to the message queue so that it can be automatically sent when the connection next becomes idle. * @param message The message to add to the queue. */ queue(message: LoginServerConnectionMessage): Promise; _sendNextMessageInQueue(): Promise; _flushStreamBuffer(): void; _idle(): void; get isConnected(): boolean; get accountData(): HiRezAccount; } export {}; //# sourceMappingURL=Main.d.ts.map