netkitty
Version:
Network tools kit
35 lines • 1.26 kB
TypeScript
import EventEmitter from 'events';
import { MessageClient } from 'socket-ipc';
import { PipeMessageHandler } from './PipeMessageHandler';
export interface IPipeClientOptions {
id: string;
socketPath: string;
actions: Record<string, (...args: any[]) => Promise<any>>;
}
export declare class PipeClient extends EventEmitter {
#private;
protected readonly id: string;
protected readonly socketPath: string;
protected readonly client: MessageClient;
protected readonly pipeMessageHandler: PipeMessageHandler;
readonly actions: Record<string, (...args: any[]) => Promise<any>>;
get connected(): boolean;
constructor(options: IPipeClientOptions);
/**
* Invoke server side action
* @param act
* @param args
*/
invoke(act: string, ...args: any[]): Promise<any>;
/**
* Notify event to pipe server
* @param event
* @param args
*/
notify(event: string, ...args: any[]): void;
on(eventName: 'ready', listener: () => void): this;
on(eventName: string, listener: (...args: any) => void): this;
once(eventName: 'ready', listener: () => void): this;
once(eventName: string, listener: (...args: any) => void): this;
}
//# sourceMappingURL=PipeClient.d.ts.map