import { RealtimeConfig, RealtimeConnection, RealtimeSubscription, RealtimeEvents, RealtimeMessage, RealtimeSubscriptionOptions } from "./types"; export declare class NexaBaseRealtime { private config; private transport; private connection?; private websocket?; private ioSocket?; private reconnectTimer?; private heartbeatTimer?; private subscriptions; constructor(config: RealtimeConfig); /** * Connect to the realtime server */ connect(): Promise; private connectWebSocket; /** * Connect using Socket.IO/Engine.IO framing - required for backend-v1, whose * /realtime gateway is a NestJS @nestjs/websockets endpoint running on socket.io, * not a plain WebSocket server. */ private connectSocketIO; /** * Disconnect from the realtime server */ disconnect(): void; /** * Subscribe to realtime events for a collection */ subscribe(collection: string, callback: (message: RealtimeMessage) => void, options?: RealtimeSubscriptionOptions): string; /** * Unsubscribe from realtime events */ unsubscribe(subscriptionId: string): void; /** * Send a broadcast message */ broadcast(collection: string, event: string, data: any): void; private buildWebSocketUrl; private handleMessage; private processMessage; private handleDatabaseEvent; /** * Handle a `collection_change` event received over Socket.IO (backend-v1 shape: * {collection, event: 'created'|'updated'|'deleted', record, timestamp, tenantId}), * translating it into the same RealtimeMessage shape used by the plain-WebSocket path * so both transports share one filtering/dispatch code path. */ private handleCollectionChangeSocketIO; private shouldNotifySubscription; private handleBroadcast; private handlePresence; private handleError; private handleHeartbeat; private handleDisconnection; private attemptReconnection; private startHeartbeat; private sendMessage; private generateConnectionId; private generateSubscriptionId; private eventListeners; on(event: string, callback: (data: any) => void): void; off(event: string, callback: (data: any) => void): void; private emit; isConnected(): boolean; getConnection(): RealtimeConnection | undefined; getSubscriptions(): RealtimeSubscription[]; /** * Get connection status */ getStatus(): "connecting" | "connected" | "disconnected" | "error" | undefined; /** * Get reconnection attempts count */ getReconnectAttempts(): number; /** * Force reconnection */ reconnect(): Promise; /** * Subscribe to all events for a collection */ subscribeToCollection(collection: string, callback: (message: RealtimeMessage) => void): string; /** * Subscribe to specific events for a collection */ subscribeToEvents(collection: string, events: RealtimeEvents[], callback: (message: RealtimeMessage) => void, filters?: Record): string; /** * Unsubscribe from all subscriptions for a collection */ unsubscribeFromCollection(collection: string): void; /** * Clear all subscriptions */ clearAllSubscriptions(): void; /** * Get subscription count */ getSubscriptionCount(): number; /** * Check if subscribed to a collection */ isSubscribedTo(collection: string): boolean; }