ps2census
Version:
Client to connect to the PS2 Event Stream websocket.
47 lines • 1.83 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CensusClient = void 0;
const eventemitter3_1 = require("eventemitter3");
const stream_manager_1 = require("./stream.manager");
const rest_client_1 = require("../rest/rest.client");
const managers_1 = require("./managers");
class CensusClient extends eventemitter3_1.EventEmitter {
constructor(serviceId, environment, { streamManager, rest, characterManager } = {}) {
super();
this.serviceId = serviceId;
this.environment = environment;
this.serviceId = serviceId;
this.rest = new rest_client_1.RestClient(environment, { serviceId, ...rest });
this.characterManager = new managers_1.CharacterManager(this, characterManager);
this.streamManager = new stream_manager_1.StreamManager(this, streamManager);
}
async watch() {
await this.streamManager.connect();
}
destroy() {
this.streamManager.disconnect();
}
subscribe(subscription) {
return this.streamManager.subscriptionManager.subscribe(subscription);
}
unsubscribe(subscription) {
return this.streamManager.subscriptionManager.unsubscribe(subscription);
}
unsubscribeAll() {
return this.streamManager.subscriptionManager.unsubscribeAll();
}
resubscribe(reset = false) {
return this.streamManager.subscriptionManager.resubscribe(reset);
}
verifySubscription() {
return this.streamManager.subscriptionManager.verifySubscription();
}
recentCharacters() {
return this.streamManager.commandHandler.recentCharacters();
}
recentCharacterCount() {
return this.streamManager.commandHandler.recentCharacterCount();
}
}
exports.CensusClient = CensusClient;
//# sourceMappingURL=census.client.js.map