UNPKG

container.ts

Version:
40 lines (39 loc) 1.46 kB
/// <reference types="node" /> import * as net from "net"; import { IModuleOptions } from "../../container"; import { Observable } from "../../container/RxJS"; import { IScriptsWorkerOptions, Scripts, ScriptsProcess } from "./Scripts"; /** Node.js scripts with server interface. */ export declare class ScriptsNet extends Scripts { /** Default module name. */ static readonly moduleName: string; /** Log names. */ static readonly LOG: { WORKER_START: string; WORKER_STOP: string; WORKER_EXIT: string; WORKER_RESTART: string; WORKER_RESTART_LIMIT: string; WORKER_UPTIME_LIMIT: string; } & { UP: string; DOWN: string; CONNECTION: string; }; /** Scripts server for connecting workers. */ readonly server: net.Server; protected readonly close$: Observable<void>; protected readonly connection$: Observable<net.Socket>; protected readonly error$: Observable<any>; /** Get server port number. */ readonly port: number; constructor(options: IModuleOptions); moduleUp(): Observable<void>; moduleDown(): void | Observable<void>; startWorker(name: string, target: string, options?: IScriptsWorkerOptions): Observable<ScriptsProcess>; connectWorkers(channel: string, one: string, two: string): Observable<boolean>; protected createConnection(): Observable<{ parent: net.Socket; child: net.Socket; }>; }