diff --git a/engine/server.ts b/engine/server.ts index 1e559b8..0dceb32 100644 --- a/engine/server.ts +++ b/engine/server.ts @@ -59,7 +59,8 @@ export interface ChannelEngineOpts { noSessionDataTags?: boolean; volatileKeyTTL?: number; autoCreateSession?: boolean; - sessionResetKey?:string; + sessionResetKey?: string; + keepAliveTimeout?: number; } interface StreamerOpts { @@ -255,6 +256,11 @@ export class ChannelEngine { this.assetMgr = assetMgr; this.monitorTimer = {}; this.server = restify.createServer(); + if (options && options.keepAliveTimeout) { + this.server.server.keepAliveTimeout = options.keepAliveTimeout; + this.server.server.headersTimeout = options.keepAliveTimeout + 1000; + } + console.log(this.server); this.server.use(restify.plugins.queryParser()); this.serverStartTime = Date.now(); this.instanceId = uuidv4(); diff --git a/examples/default.ts b/examples/default.ts index 1629b21..658a7c6 100644 --- a/examples/default.ts +++ b/examples/default.ts @@ -106,6 +106,7 @@ const engineOptions: ChannelEngineOpts = { "https://maitv-vod.lab.eyevinn.technology/slate-consuo.mp4/master.m3u8", slateRepetitions: 10, redisUrl: process.env.REDIS_URL, + keepAliveTimeout: process.env.KEEP_ALIVE_TIMEOUT ? parseInt(process.env.KEEP_ALIVE_TIMEOUT) * 1000: undefined }; const engine = new ChannelEngine(refAssetManager, engineOptions);