diff --git a/src/geckos/geckos.service.ts b/src/geckos/geckos.service.ts index 99cc553..cf68a57 100644 --- a/src/geckos/geckos.service.ts +++ b/src/geckos/geckos.service.ts @@ -25,7 +25,13 @@ export class GeckosIoService { const geckosModule = await import('@geckos.io/server'); const geckos = geckosModule.default; - this.io = geckos({ iceServers: customIceServers }); + this.io = geckos({ + iceServers: customIceServers, + cors: { + origin: 'https://mini-game-world.com', + allowAuthorization: true // 클라이언트와 서버가 다른 도메인에 있는 경우 필요 + } + }); this.io.listen(process.env.UDP_PORT, { host: '0.0.0.0' }); this.logger.log('Geckos.io server initialized'); this.initialized = true; diff --git a/src/status/status.gateway.ts b/src/status/status.gateway.ts index 531861c..bf8f9b1 100644 --- a/src/status/status.gateway.ts +++ b/src/status/status.gateway.ts @@ -15,7 +15,7 @@ import { CacheService } from '../cache/cache.service.js'; import { StatsService } from '../cache/stats.service.js'; import { EventEmitter2 } from '@nestjs/event-emitter'; -@WebSocketGateway({ cors: { origin: "*" } }) +@WebSocketGateway({ cors: { origin: "https://mini-game-world.com" } }) export class StatusGateway implements OnGatewayInit, OnGatewayConnection, OnGatewayDisconnect { private CHECK_INTERVAL = 5000; private MIN_PLAYERS_FOR_BOMB_GAME = 3; // 최소 플레이어 수, 예시로 4명 설정