///
import { ServerOptions } from 'https';
import { RequestHandler } from 'express';
import { HttpService } from './http/index';
import { WebSocketService, WebService } from './rpc/index';
export interface AutoScalingOptions {
/**
* Sets an http GET endpoint that can be inspected by an auto scaling process. This endpoint
* will return a response indicating if this host is oversaturated as indicated by the
* this threshold property. If connections exceed the configured threshold this endpoint
* will respond with status 500, otherwise 200.
*/
endpoint: string;
/**
* The maximum number of connections before the auto scaling endpoint begins returning
* 500 status response codes. This is only used if `healthEnabled` is set to true.
*/
threshold: number;
}
export interface HostOptions {
/**
* Sends a `ping` signal to each connected socket to prevent inactive sockets being terminated by a load balancer.
*
* (Default is 8000)
*/
keepAliveTimeout: number;
/**
* Disables client message compression.
*
* (Default is false)
*/
disableFrameCompression: boolean;
/**
* Sets the maximum number of concurrent Web Sockets able to connect to this Host.
*
* (Default is 16384)
*/
maxSocketCount: number;
/**
* Configuration options for auto scaling web processes in load balanced in environments.
*
* (Default is undefined)
*/
autoScaling?: AutoScalingOptions;
}
/**
* A Host is a network service mount. It handles the details of listening
* to network interfaces and allows multiple WebService, WebSocketService
* and Express middleware to be mounted as services.
*/
export declare class Host {
#private;
constructor(options?: Partial);
/** Uses a WebSocketService to the specified path */
use(path: string, service: WebSocketService): void;
/** Uses a WebService to the specified path */
use(path: string, service: WebService): void;
/** Uses a HttpService to the specified path */
use(path: string, service: HttpService): void;
/** Uses express middleware on the specified path */
use(path: string, service: RequestHandler): void;
/** Uses a WebSocketService */
use(service: WebSocketService): void;
/** Uses a WebService */
use(service: WebService): void;
/** Uses a HttpService */
use(service: HttpService): void;
/** Uses express middleware */
use(middleware: RequestHandler): void;
/** Listens on the given port and optional hostname */
listen(port: number, hostname?: string, options?: ServerOptions): Promise;
/** Listens on the given port and optional hostname. Requires key and cert properties to passed as options. */
listenTls(port: number, hostname?: string, options?: ServerOptions): Promise;
/** Disposes this host and terminates all connections */
dispose(): Promise;
}