# Spot the bug: Node.js / NestJS > One snippet. Find the bug, or prove there isn't one. Daily challenge: 2026-08-19 (UTC) ยท Mid-Level ```typescript import { WebSocketGateway, SubscribeMessage, MessageBody, ConnectedSocket } from '@nestjs/websockets'; import { Socket } from 'socket.io'; import { MessagesService } from './messages.service'; @WebSocketGateway({ namespace: 'chat' }) export class ChatGateway { constructor(private readonly messages: MessagesService) {} @SubscribeMessage('joinRoom') async joinRoom( @ConnectedSocket() client: Socket, @MessageBody() data: { roomId: string }, ) { client.join(data.roomId); const history = await this.messages.getRoomHistory(data.roomId); client.emit('history', history); } } ``` ## Your verdict - Security flaw - Logic bug - Code style - No issue One attempt per day. The answer shows up right after. --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/en/daily/node-nestjs