import { OnDiscontinuitySubscriptionResponse } from '@ably/chat'; import { jsonRpcBlocking } from './jsonrpc'; export class RpcOnDiscontinuitySubscriptionResponse implements OnDiscontinuitySubscriptionResponse { private readonly _instanceId: string; constructor(instanceId: string) { this._instanceId = instanceId; // it is common to destructure this object when received from the subscription function, // so we need to bind its functions to preserve reference to this this.off = this.off.bind(this); } off(): void { jsonRpcBlocking.request('OnDiscontinuitySubscriptionResponse.off', { refId: this._instanceId }); } }