import { SubscribeMessage , WebSocketGateway } from '@nestjs/websockets' ; @ WebSocketGateway ( ) export class AppGateway { @ SubscribeMessage ( 'message' ) handleMessage ( client , payload ) { return `Hello, ${ payload . name || 'World' }!` ; } }