From f40f4daa1a8448d37fedb0b15a96b348958c83da Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Tue, 27 Jan 2026 02:03:59 +0000 Subject: [PATCH] cleanup --- .../src/collaboration/collaboration.gateway.ts | 13 +++++++------ .../extensions/redis-sync/redis-sync.types.ts | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/server/src/collaboration/collaboration.gateway.ts b/apps/server/src/collaboration/collaboration.gateway.ts index 453681ae..b296c520 100644 --- a/apps/server/src/collaboration/collaboration.gateway.ts +++ b/apps/server/src/collaboration/collaboration.gateway.ts @@ -85,30 +85,31 @@ export class CollaborationGateway { method: request.method ?? 'GET', url: request.url ?? '/', headers: { - ...request.headers, 'sec-websocket-key': request.headers['sec-websocket-key'] ?? '', - } as SerializedHTTPRequest['headers'], + 'sec-websocket-protocol': + request.headers['sec-websocket-protocol'] ?? '', + }, socket: { remoteAddress: request.socket?.remoteAddress ?? '' }, }; } handleConnection(client: WebSocket, request: IncomingMessage): any { if (this.redisSync) { - const serializedRequest = this.serializeRequest(request); - const socketId = serializedRequest.headers['sec-websocket-key']; + const serializedHTTPRequest = this.serializeRequest(request); + const socketId = serializedHTTPRequest.headers['sec-websocket-key']; // Create wrapper socket that only receives events via emit() // This prevents double-handling since Hocuspocus won't listen to raw WebSocket events const wrappedSocket = new WsSocketWrapper(client); // Route through RedisSync extension (this calls handleConnection internally) - this.redisSync.onSocketOpen(wrappedSocket as any, serializedRequest); + this.redisSync.onSocketOpen(wrappedSocket as any, serializedHTTPRequest); // Forward raw WebSocket messages to the extension client.on('message', (data: ArrayBuffer) => { this.redisSync!.onSocketMessage( wrappedSocket as any, - serializedRequest, + serializedHTTPRequest, data, ); }); diff --git a/apps/server/src/collaboration/extensions/redis-sync/redis-sync.types.ts b/apps/server/src/collaboration/extensions/redis-sync/redis-sync.types.ts index dd92cacd..44960a64 100644 --- a/apps/server/src/collaboration/extensions/redis-sync/redis-sync.types.ts +++ b/apps/server/src/collaboration/extensions/redis-sync/redis-sync.types.ts @@ -13,7 +13,7 @@ export type SecondParam = T extends ( export type SerializedHTTPRequest = { method: string; url: string; - headers: IncomingHttpHeaders & { 'sec-websocket-key': string }; + headers: IncomingHttpHeaders; socket: { remoteAddress: string }; };