Skip to content

Commit

Permalink
Merge pull request #128 from mini-game-world/#127_cors
Browse files Browse the repository at this point in the history
#127 feat : cors를 *에서 domain name으로 바꿈
  • Loading branch information
J-Jaeh authored Jul 17, 2024
2 parents 21c54a0 + c710c22 commit 9c8630e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/geckos/geckos.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/status/status.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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명 설정
Expand Down

0 comments on commit 9c8630e

Please sign in to comment.