@boringnode/transmit
Version:
A framework agnostic Server-Sent-Event library
52 lines (51 loc) • 1.26 kB
TypeScript
import { Stream } from './stream.js';
export declare class Storage {
#private;
/**
* Secure a channel
*/
secure(channel: string): void;
/**
* Check if a channel is secured and return the matched channel
*/
getSecuredChannelDefinition(channel: string): {
params: Record<string, string>;
channel: string;
} | undefined;
/**
* Get the number of secured channels
*/
getSecuredChannelCount(): number;
/**
* Get the number of streams
*/
getStreamCount(): number;
/**
* Add a stream to the storage
*/
add(stream: Stream): void;
/**
* Remove a stream from the storage
*/
remove(stream: Stream): void;
/**
* Add a channel to a stream
*/
subscribe(uid: string, channel: string): boolean;
/**
* Remove a channel from a stream
*/
unsubscribe(uid: string, channel: string): boolean;
/**
* Find all subscribers to a channel
*/
findByChannel(channel: string): Set<Stream>;
/**
* Get channels for a given client
*/
getChannelByClient(uid: string): Set<string> | undefined;
/**
* Get all subscribers
*/
getAllSubscribers(): Map<Stream, Set<string>>;
}