Skip to content

Commit

Permalink
polls socket adapter init
Browse files Browse the repository at this point in the history
  • Loading branch information
AmmarAlkhooly98 committed Dec 26, 2023
1 parent 38fbca6 commit 8af45ac
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions server/src/socket-io-adapter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { INestApplicationContext, Logger } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { IoAdapter } from '@nestjs/platform-socket.io';
import { ServerOptions } from 'socket.io';

export class SocketIOAdapter extends IoAdapter {
private readonly logger = new Logger(SocketIOAdapter.name);
constructor(
private app: INestApplicationContext,
private configService: ConfigService,
) {
super(app);
}

createIOServer(port: number, options?: ServerOptions) {
const clientPort = parseInt(this.configService.get('CLIENT_PORT'));

const cors = {
origin: [`http://localhost:${clientPort}`],
};
}
}

0 comments on commit 8af45ac

Please sign in to comment.