fixed cors

This commit is contained in:
AmirHossein Mahmoodi
2025-05-04 12:12:24 +03:30
parent 1224a8dfbf
commit 25fcd1021f
2 changed files with 15 additions and 3 deletions

View File

@@ -5,12 +5,20 @@ import {
WebSocketServer,
} from '@nestjs/websockets';
import { Server, Socket } from 'socket.io';
import { SocketService } from './socket.service';
import { SendMessageDto } from './dto/sendMessage.dto';
import { SocketService } from './socket.service';
@WebSocketGateway()
@WebSocketGateway({
namespace: '/notification',
cors: {
origin: '*',
},
transports: ['websocket'],
path: '/notification/socket.io', // آدرس سفارشی
})
export class SocketGateway implements OnGatewayConnection {
@WebSocketServer() server: Server;
@WebSocketServer()
server: Server;
constructor(private socketService: SocketService) {}