process-tunnel
Version:
49 lines (48 loc) • 1.2 kB
TypeScript
/// <reference types="node" />
import Interface from '.';
import * as tls from 'tls';
import { RemoteQueue } from "../remote-queue";
export declare type Queue = any;
export declare enum ChannelType {
CALL = 0,
MAP = 1
}
export declare enum MessageType {
ACK = 0,
REQ = 1,
ERR = 2
}
export interface Channel extends tls.TLSSocket {
type: ChannelType;
name: string;
queue: RemoteQueue;
prefix?: string;
}
export declare class QueuedMessage {
promise: Promise<any>;
private id;
private _resolve;
private _reject;
private type;
private name;
private args;
private _queue;
timeout: NodeJS.Timeout | null;
private handler?;
constructor(type: ChannelType, name: string, args: any[]);
setHandler(handler?: Function): void;
resolve(result: any): any;
reject(reason?: any): any;
bind(queue: Queue): this;
pop(): any;
toJSON(self: Interface): {
type: ChannelType;
name: string;
args: any[];
callback: string;
endpoint: {
port: number | undefined;
host: string | undefined;
};
};
}