@synet/realtime
Version:
Realtime Communication server/client implementations
37 lines (36 loc) • 1.33 kB
TypeScript
import type { RealtimeChannel, ChannelOptions } from '@synet/patterns/realtime';
import type { RealtimeProvider, RealtimeProviderOptions } from '@synet/patterns/realtime';
import type { RealtimeEvent } from '@synet/patterns/realtime';
import type { GunOptions } from './gun-types';
/**
* GUN implementation of RealtimeProvider
*/
export declare class GunRealtimeProvider implements RealtimeProvider {
readonly url: string;
private options;
private gun;
private channels;
/**
* Create a new GUN provider
* @param url URL of the GUN server (e.g., http://localhost:8765)
* @param options Provider configuration options
*/
constructor(url: string, options?: RealtimeProviderOptions<GunOptions>);
/**
* Create a channel for real-time communication
*/
createChannel<TIn extends RealtimeEvent = RealtimeEvent, TOut extends RealtimeEvent = RealtimeEvent>(topic: string, options?: ChannelOptions): RealtimeChannel<TIn, TOut>;
/**
* Remove a channel and stop receiving events
* @param channel The channel to remove
*/
removeChannel(channel: RealtimeChannel): Promise<void>;
/**
* Get all active channels
*/
getChannels(): RealtimeChannel[];
/**
* Close all channels and clean up resources
*/
disconnect(): Promise<void>;
}