UNPKG

ps2census

Version:

Client to connect to the PS2 Event Stream websocket.

66 lines (65 loc) 1.75 kB
import { CensusClient } from './census.client'; import { StreamClientOptions } from '../stream/stream.client'; import { SubscriptionManager } from './subscription.manager'; import { EventSubscription } from './types/event-subscription.types'; import { CommandHandler } from './command.handler'; export interface StreamManagerOptions extends StreamClientOptions { subscription?: EventSubscription; reconnectDelay?: number; } export declare class StreamManager { readonly client: CensusClient; /** * The event stream */ private readonly stream; /** * @type {SubscriptionManager} Manages the subscription */ readonly subscriptionManager: SubscriptionManager; /** * @type {StreamHandler} handles events, and subscriptions */ private readonly streamHandler; /** * @type {CommandHandler} handles commands */ readonly commandHandler: CommandHandler; /** * @type {boolean} whether the connection has been started */ private isStarted; /** * @type {number} delay before trying to reconnect */ private readonly reconnectDelay; /** * @type {Timeout?} The reconnect timeout */ private reconnectTimeout?; /** * @param {CensusClient} client * @param {StreamManagerOptions} options */ constructor(client: CensusClient, options?: StreamManagerOptions); /** * */ private prepareEventStream; /** * Start connection * * @return {Promise<void>} */ connect(): Promise<void>; /** * Bye bye * * @return {Promise<void>} */ disconnect(): void; /** * Connection has done something, now we need a new one */ private reconnect; }