From 2b919c4eb0dddd668a7f541122d54f191a0872c3 Mon Sep 17 00:00:00 2001 From: PrivateGER Date: Tue, 25 Feb 2025 22:07:59 +0100 Subject: Optionally enable websocket compression --- packages/backend/src/server/api/StreamingApiServerService.ts | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'packages/backend/src/server/api/StreamingApiServerService.ts') diff --git a/packages/backend/src/server/api/StreamingApiServerService.ts b/packages/backend/src/server/api/StreamingApiServerService.ts index 6e7abcfae6..4eb11f2956 100644 --- a/packages/backend/src/server/api/StreamingApiServerService.ts +++ b/packages/backend/src/server/api/StreamingApiServerService.ts @@ -26,6 +26,7 @@ import MainStreamConnection from './stream/Connection.js'; import { ChannelsService } from './stream/ChannelsService.js'; import type * as http from 'node:http'; import type { IEndpointMeta } from './endpoints.js'; +import type {Config} from "@/config.js"; @Injectable() export class StreamingApiServerService { @@ -49,6 +50,9 @@ export class StreamingApiServerService { private channelFollowingService: ChannelFollowingService, private rateLimiterService: SkRateLimiterService, private loggerService: LoggerService, + + @Inject(DI.config) + private config: Config, ) { } @@ -74,6 +78,7 @@ export class StreamingApiServerService { public attach(server: http.Server): void { this.#wss = new WebSocket.WebSocketServer({ noServer: true, + perMessageDeflate: this.config.websocketCompression ?? false, }); server.on('upgrade', async (request, socket, head) => { -- cgit v1.2.3-freya