// gateway/gateway.controller.ts import { Controller, OnModuleInit } from "@nestjs/common"; import { WebSocketGateway, SubscribeMessage, MessageBody } from "@nestjs/websockets"; import { GatewayService } from "./gateway.service"; @Controller('gateway') @WebSocketGateway(3001, { cors: { origin: process.env.CLIENT_URL, methods: ["GET", "POST"], allowedHeaders: ["Content-Type"], credentials: true, }, namespace: '/' }) export class GatewayController implements OnModuleInit { constructor(private readonly gatewayService: GatewayService) { } onModuleInit() { console.log('INITED ') } @SubscribeMessage('newQuestion') onNewQuestion(@MessageBody() body: any) { return this.gatewayService.onNewQuestion(body); } }