UNPKG

@ably/chat

Version:

Ably Chat is a set of purpose-built APIs for a host of chat features enabling you to create 1:1, 1:Many, Many:1 and Many:Many chat rooms for any scale. It is designed to meet a wide range of chat use cases, such as livestreams, in-game communication, cust

41 lines (39 loc) 1.26 kB
/** * Represents a subscription that can be unsubscribed from. * This interface provides a way to clean up and remove subscriptions when they * are no longer needed. * @example * ```typescript * const s = someService.subscribe(); * // Later when done with the subscription * s.unsubscribe(); * ``` */ export interface Subscription { /** * This method should be called when the subscription is no longer needed, * it will make sure no further events will be sent to the subscriber and * that references to the subscriber are cleaned up. */ readonly unsubscribe: () => void; } /** * Represents a subscription to status change events that can be unsubscribed from. This * interface provides a way to clean up and remove subscriptions when they are no longer needed. * @example * ```typescript * const s = someService.onStatusChange(); * const s2 = someOtherService.on() * // Later when done with the subscription * s.off(); * s2.off(); * ``` */ export interface StatusSubscription { /** * Unsubscribes from the status change events. It will ensure that no * further status change events will be sent to the subscriber and * that references to the subscriber are cleaned up. */ readonly off: () => void; }