///
import { EventEmitter } from 'events';
import RestClient from './RestClient';
/**
* There are 3 ways to subscribe for notifications: by event filters; by subscription id; by subscription data.
*/
export default class Subscription extends EventEmitter {
rest: RestClient;
id: string;
eventFilters: string[];
expirationTime: number;
subscribeKey: string;
address: string;
encryptionKey: string;
refreshTimer: NodeJS.Timer;
retryInterval: number;
pubnub: any;
debug: boolean;
private reqId;
constructor(restClient: RestClient, opts?: {
debug?: boolean;
});
/**
* expiresIn Optional. Subscription lifetime in seconds. Max value is 7 days (604800 sec)
* The 'expiresIn' is not supported.
*
* Errors migh occur:
* errorCode: 'SUB-505',
* message: 'Subscriptions limit exceeded'
*/
subscribe(filters?: string[]): Promise;
/**
* Set subscription data from referesh, newly created or get by id.
*/
setData(subscription: any, reqId?: number): void;
cancel(): Promise;
onMessage(listener: (...args: any[]) => void): void;
private clearRefreshTimer();
/**
* Subscription deleted from the RC Platform
*/
private subscriptionDeleted();
private connectPushServer();
private disconnectPushServer();
private scheduleRefresh(timeout);
private refresh();
}