Skip to content

Commit

Permalink
Default brotli compression is 11, way too high for realtime use
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvullings committed Mar 25, 2021
1 parent 964e94e commit e3c4513
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
const cors = require('@koa/cors');
import * as fs from 'fs';
import * as http from 'http';
import * as zlib from 'zlib';
import Koa from 'koa';
import koaBody from 'koa-body';
import serve from 'koa-static';
Expand Down Expand Up @@ -36,7 +37,15 @@ export const createApi = (config: ICommandOptions): { api: Koa; server?: http.Se
if (config.compression) {
console.log('Enabled compression with koa-compress.');
// api.use(cors({ credentials: true }));
api.use(compress());
api.use(
compress({
br: {
params: {
[zlib.constants.BROTLI_PARAM_QUALITY]: 3,
},
},
}),
);
}

const ss = config.io ? createSocketService(api) : undefined;
Expand Down

0 comments on commit e3c4513

Please sign in to comment.