diff --git a/backend/src/realtime/websocket/websocket.gateway.ts b/backend/src/realtime/websocket/websocket.gateway.ts index 8fc5491c0..8a72bac9e 100644 --- a/backend/src/realtime/websocket/websocket.gateway.ts +++ b/backend/src/realtime/websocket/websocket.gateway.ts @@ -87,20 +87,22 @@ export class WebsocketGateway implements OnGatewayConnection { await this.realtimeNoteService.getOrCreateRealtimeNote(note); const websocketTransporter = new MessageTransporter(); + websocketTransporter.setAdapter( + new BackendWebsocketAdapter(clientSocket), + ); + const permissions = await this.noteService.toNotePermissionsDto(note); const acceptEdits: boolean = userCanEdit( permissions as NotePermissions, user?.username, ); + const connection = new RealtimeConnection( websocketTransporter, user, realtimeNote, acceptEdits, ); - websocketTransporter.setAdapter( - new BackendWebsocketAdapter(clientSocket), - ); realtimeNote.addClient(connection);