/** * Class which orders the synchronization packets */ declare class PacketOrderer { private _outOfOrderListener; private _orderingTimeoutInSeconds; private _isOutOfOrderEmitted; private _waitListSizeLimit; private _sequenceNumberByInstance; private _lastSessionStartTimestamp; private _packetsByInstance; private _outOfOrderInterval; /** * Constructs the class * @param {Function} outOfOrderListener function which will receive out of order packet events * @param {Number} orderingTimeoutInSeconds packet ordering timeout */ constructor(outOfOrderListener: any, orderingTimeoutInSeconds: any); /** * Initializes the packet orderer */ start(): void; /** * Deinitialized the packet orderer */ stop(): void; /** * Processes the packet and resolves in the order of packet sequence number * @param {Object} packet packet to process * @return {Array} ordered packets when the packets are ready to be processed in order */ restoreOrder(packet: T): PacketOrderer.Packet[]; /** * Resets state for instance id * @param {String} instanceId instance id to reset state for */ onStreamClosed(instanceId: any): void; /** * Resets state for specified accounts on reconnect * @param {String[]} reconnectAccountIds reconnected account ids */ onReconnected(reconnectAccountIds: any): void; _getAccountIdFromInstance(instanceId: any): any; _findNextPacketsFromWaitList(instanceId: any): any[]; _emitOutOfOrderEvents(): void; } declare namespace PacketOrderer { /** Packet to order. Can be extended, the same input packet object reference will be returned */ type Packet = { /** Account ID */ accountId?: string; /** Instance index. Defaults to `0` */ instanceIndex?: number; /** Source server host. Defaults to `0` */ host?: string | number; /** Packet type */ type?: string; /** Sequence number */ sequenceNumber?: number; /** Synchronization ID */ synchronizationId?: string; /** Sequence timestamp */ sequenceTimestamp?: number; }; } export default PacketOrderer;