async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.useWebSocketAdapter(new GatewayAdapter(app));
app.use(cookieParser());
app.use(helmet());
await app.listen(process.env.PORT || 8080);
}
bootstrap();
@WebSocketGateway({
namespace: 'chat'
})
export class ChatGateway {}
Connecting to the backend and calling APIs work fine, but connecting to the websocket requires enabling the VPN. After enabling the VPN, a connection will be established. This issue only occurs when the app is deployed to Heroku while it works fine on localhost.