UNPKG

@bmqube/xmlrpc

Version:

A pure TypeScript XML-RPC client and server. Forked from (https://github.com/baalexander/node-xmlrpc)

28 lines (27 loc) 885 B
import * as http from "http"; import * as https from "https"; import { EventEmitter } from "events"; type OnListening = () => void; export interface ServerInitOptions { host?: string; port: number; [key: string]: any; } /** * XML-RPC Server that listens for method calls and emits events with the method name. * * Usage: * const srv = new Server({ host: "127.0.0.1", port: 9090 }, false, () => { * console.log("listening"); * }); * srv.on("sum", (err, params, reply) => { reply(null, params[0] + params[1]); }); */ export default class Server extends EventEmitter { httpServer: http.Server | https.Server; constructor(options: ServerInitOptions | string, isSecure?: boolean, onListening?: OnListening); /** * Closes the underlying server. The callback is invoked after 'close'. */ close(callback: () => void): void; } export {};