/// /// /// import * as http from "http"; import * as https from "https"; import { Socket } from "net"; import { AdapterAbstract } from "../../core"; import { HttpAdapterConfigInterface } from "./interfaces"; import { HttpRequestExtend, HttpResponseExtend } from "./extends"; export * from "./interfaces"; /** * HTTP Server Adapter for JSONRPC Server * * * @author Mahsum UREBE * @licence MIT * * @example * // Create adapter for HTTP Connection * const adapter = new HttpAdapter({ * hostname: "localhost", * port: 3000, * }) * * @example * // Create adapter for HTTPs Connection * const adapter = new HttpAdapter({ * hostname: "localhost", * port: 3000, * ssl: { * certFile: "/path/to/site.cert", * privateKey: "/path/to/site.key", * }, * }) */ export declare class HttpAdapter extends AdapterAbstract { readonly config: HttpAdapterConfigInterface; /** * Http Server * * @type {http.Server | https.Server} */ server: http.Server | https.Server; /** * Sockets * @protected */ protected sockets: { [socketId: string]: Socket; }; /** * Server is started * * @protected */ protected isListened: boolean; constructor(config: HttpAdapterConfigInterface); /** * Listen server * * @return {Promise} */ listen(): Promise; /** * Shutdown server * * @return {Promise} */ shutdown(): Promise; /** * Check server is listening * * @return {boolean} */ isListening(): boolean; /** * Request Listener * @param {object} req Request * @param {object} res Response * * @return {Promise} */ private requestListener; }