import type { ClientMessage, MessageMeta, HistoryResult, HistoryOptions, PublishOptions } from '../types.js'; import { Presence } from './presence.js'; export declare class Channel { readonly name: string; private sendFn; private listeners; private subscribed; readonly presence: Presence; constructor(name: string, sendFn: (msg: ClientMessage) => void); /** * Subscribe to messages on this channel. * * @param callback - Handler called for each received message * @param options - Optional subscribe options * @param options.rewind - Number of past messages to replay on subscribe * @returns `this` for chaining */ subscribe(callback: (data: unknown, meta: MessageMeta) => void, options?: { rewind?: number; }): this; /** * Publish data to this channel. * * @param data - Message payload * @param options - Publish options * @returns `this` for chaining */ publish(data: unknown, options?: PublishOptions): this; /** * Query message history for this channel. * Listen for results with {@link onHistory}. * * @param options - Query options (limit, before, after, direction) * @returns `this` for chaining */ history(options?: HistoryOptions): this; /** * Listen for history query results. * * @param callback - Handler called with the history result * @returns `this` for chaining */ onHistory(callback: (result: HistoryResult) => void): this; /** @internal Emit history result to listeners */ _emitHistory(result: HistoryResult): void; /** Unsubscribe from this channel and remove all message listeners */ unsubscribe(): void; /** @internal Emit a message to listeners */ _emit(data: unknown, meta: MessageMeta): void; /** @internal Mark as needing re-subscribe (after reconnect) */ _markForResubscribe(): void; /** @internal Whether this channel has active listeners */ get _hasListeners(): boolean; /** Whether this channel is currently subscribed on the server */ get isSubscribed(): boolean; } //# sourceMappingURL=channel.d.ts.map