UNPKG

@twurple/eventsub-http

Version:

Listen to events on Twitch via their EventSub API using a HTTP/WebHook server.

53 lines (52 loc) 1.42 kB
import { __decorate } from "tslib"; import { rtfm } from '@twurple/common'; import { checkHostName } from '../checks.js'; import { ConnectionAdapter } from './ConnectionAdapter.js'; /** * A WebHook connection adapter that supports a reverse proxy in front of the listener. * * @hideProtected * * @meta category adapters */ let ReverseProxyAdapter = class ReverseProxyAdapter extends ConnectionAdapter { _hostName; _port; _pathPrefix; _usePathPrefixInHandlers; /** * Creates a reverse proxy connection adapter. * * @expandParams * * @param options */ constructor(options) { super(); checkHostName(options.hostName); this._hostName = options.hostName; this._port = options.port ?? 8080; this._pathPrefix = options.pathPrefix; this._usePathPrefixInHandlers = options.usePathPrefixInHandlers ?? false; } /** @protected */ get listenerPort() { return this._port; } /** @protected */ async getHostName() { return this._hostName; } /** @protected */ get pathPrefix() { return this._pathPrefix; } /** @protected */ get usePathPrefixInHandlers() { return this._usePathPrefixInHandlers; } }; ReverseProxyAdapter = __decorate([ rtfm('eventsub-http', 'ReverseProxyAdapter') ], ReverseProxyAdapter); export { ReverseProxyAdapter };