solobase-js
Version:
A 100% drop-in replacement for the Supabase JavaScript client. Self-hosted Supabase alternative with complete API compatibility.
70 lines • 2.52 kB
TypeScript
import { RealtimeClient, RealtimeChannel } from './types/index.js';
export interface RealtimeChannelOptions {
config?: {
broadcast?: {
self?: boolean;
ack?: boolean;
};
presence?: {
key?: string;
};
private?: boolean;
};
}
export declare class SolobaseRealtimeChannel implements RealtimeChannel {
private topic;
private socket;
private state;
private callbacks;
private joinRef;
private ref;
private heartbeatTimer;
private reconnectTimer;
private params;
private timeout;
private heartbeatIntervalMs;
private reconnectAfterMs;
private logger;
private encode;
private decode;
private endpointURL;
private accessToken;
constructor(topic: string, endpointURL: string, params?: any, timeout?: number, heartbeatIntervalMs?: number, logger?: (level: string, message: string, data?: any) => void, encode?: (payload: any, callback: (encoded: any) => void) => void, decode?: (payload: any, callback: (decoded: any) => void) => void, reconnectAfterMs?: (tries: number) => number);
setAuth(token: string | null): void;
subscribe(callback?: (status: 'SUBSCRIBED' | 'TIMED_OUT' | 'CLOSED', err?: Error) => void): RealtimeChannel;
unsubscribe(): Promise<'ok' | 'timed_out' | 'error'>;
on(event: string, callback: (payload: any) => void): RealtimeChannel;
send(event: string, payload?: any, ref?: string, joinRef?: string): 'ok' | 'timed_out' | 'rate_limited';
private connect;
private onMessage;
private trigger;
private push;
private makeRef;
private startHeartbeat;
private stopHeartbeat;
private scheduleReconnect;
}
export declare class SolobaseRealtimeClient implements RealtimeClient {
private endpointURL;
private channels;
private accessToken;
private params;
private timeout;
private heartbeatIntervalMs;
private reconnectAfterMs;
private logger;
private encode;
private decode;
constructor(endpointURL: string, options?: any);
setAuth(token: string | null): void;
channel(topic: string, chanParams?: {
config?: any;
}): RealtimeChannel;
getChannels(): RealtimeChannel[];
removeChannel(channel: RealtimeChannel): Promise<'ok' | 'timed_out' | 'error'>;
removeAllChannels(): Promise<('ok' | 'timed_out' | 'error')[]>;
connect(): void;
disconnect(): void;
isConnected(): boolean;
}
//# sourceMappingURL=SolobaseRealtimeClient.d.ts.map