ps2census
Version:
Client to connect to the PS2 Event Stream websocket.
72 lines (71 loc) • 2.39 kB
TypeScript
import { CensusClient } from './census.client';
import { StreamClient } from '../stream/stream.client';
import { EventSubscribed, EventSubscription } from './types';
import { CommandHandler } from './command.handler';
export declare class SubscriptionManager {
private readonly client;
private readonly stream;
private readonly commandHandler;
/**
* Characters subscribed to
*/
private readonly characters;
/**
* Worlds subscribed to
*/
private readonly worlds;
/**
* Events to listen to
*/
private readonly eventNames;
/**
* Whether both worlds and characters should match
*/
private logicalAndCharactersWithWorlds;
/**
* @param {CensusClient} client the client used to emit debug events
* @param {StreamClient} stream the stream to comment, like, and subscribe to
* @param {CommandHandler} commandHandler handles rpc of the stream
* @param {EventSubscription} subscription the initial subscription
*/
constructor(client: CensusClient, stream: StreamClient, commandHandler: CommandHandler, subscription?: EventSubscription);
/**
* Registers important stream events
*/
private registerClientEvents;
/**
* Make a subscription to the stream
*
* @param {EventSubscription} subscription
*/
subscribe({ characters, worlds, eventNames, logicalAndCharactersWithWorlds, }: EventSubscription): Promise<EventSubscribed>;
/**
* Remove a subscription from the stream
*
* @param {EventSubscription} subscription
*/
unsubscribe({ characters, worlds, eventNames, logicalAndCharactersWithWorlds, }: EventSubscription): Promise<EventSubscribed>;
/**
* Purge all subscriptions
*/
unsubscribeAll(): Promise<void>;
/**
* Verifies if the subscription matches with what is expected
*
* @return {Promise<boolean>} whether the subscription is correct
*/
verifySubscription(): Promise<boolean>;
/**
* Rerun all subscriptions
*
* @param {boolean} reset When true unsubscribes from all events first
* @return {Promise<boolean>} whether it has been run(depends on stream being ready)
*/
resubscribe(reset?: boolean): Promise<boolean>;
/**
* Get current subscription
*
* @return {Subscribe}
*/
private get subscription();
}