/// import * as http from 'http'; import type { WebHookListenerCertificateConfig } from '../WebHookListener'; /** @protected */ export interface CommonConnectionAdapterConfig { /** * The port the server should listen to. */ listenerPort: number; /** * The SSL keychain that should be used to make the server available using a secure connection. * * If this is not given and there is no reverse proxy that handles incoming SSL connections, the server will only be available via HTTP. * This means it can **only listen to unauthenticated topics** (stream changes and follows). */ sslCert?: WebHookListenerCertificateConfig; } /** * Options to override when using a {@ConnectionAdapter} instance. */ export interface ConnectionAdapterOverrideOptions { defaultHookValidity?: number; } /** * An abstraction of a WebHook connection adapter. */ export declare abstract class ConnectionAdapter { private readonly _listenerPort; private readonly _ssl?; /** * Creates a new instance of the connection adapter. * * @expandParams * * @param options */ constructor(options: CommonConnectionAdapterConfig); /** * Creates the HTTP server to use for listening to events. * * @protected */ createHttpServer(): http.Server; /** * Whether the connection adapter listens using SSL. * * @protected */ get listenUsingSsl(): boolean; /** * The port the HTTP server should listen on. * * @protected */ getListenerPort(): Promise; /** * Returns the host name that should be used by Twitch to connect to the server. * * @protected */ abstract getHostName(): Promise; /** * Returns the port that should be used by Twitch to connect to the server. * * @protected */ abstract getExternalPort(): Promise; /** * Whether to use SSL to connect to the server. * * This has nothing to do with the SSL configuration given. * For example, this can be true when a reverse proxy takes care of SSL and routes to this server internally using plain HTTP. * * @protected */ abstract get connectUsingSsl(): boolean; /** * Options to override when using the adapter. */ get overrideOptions(): ConnectionAdapterOverrideOptions; /** * The path prefix an external connection needs to reach the server. * * Please note that the layer redirecting to this server needs to strip the path prefix in order for this to work. * * For example, if this is set to /hooks, an external connection to /hooks/abc should pass /abc as the path to this server. * * @protected */ get pathPrefix(): string | undefined; }