UNPKG

netkitty

Version:
39 lines 1.29 kB
import EventEmitter from 'events'; import { MessageConnection } from 'socket-ipc'; import { PipeMessageHandler } from './PipeMessageHandler'; export interface IPipeClientSocketOptions { id: string; connection: MessageConnection; actions: Record<string, (...args: any[]) => Promise<any>>; } export declare class PipeClientSocket extends EventEmitter { #private; protected readonly pipeMessageHandler: PipeMessageHandler; readonly actions: Record<string, (...args: any[]) => Promise<any>>; /** * ClientId */ get id(): string; /** * Is client socket connected */ get connected(): boolean; constructor(options: IPipeClientSocketOptions); /** * Invoke client side action * @param act * @param args */ invoke(act: string, ...args: any[]): Promise<any>; /** * Notify event to pipe client * @param event * @param args */ notify(event: string, ...args: any[]): void; on(eventName: 'disconnect', listener: () => void): this; on(eventName: string, listener: (...args: any) => void): this; once(eventName: 'disconnect', listener: () => void): this; once(eventName: string, listener: (...args: any) => void): this; } //# sourceMappingURL=PipeClientSocket.d.ts.map