Answer the question
In order to leave comments, you need to log in
How to send authorization data to app on different port on NestJs via websockets?
there is a server application launched on the 3000th port, it authorizes/registers the user. And there is a client application on port 3001 that will send a login with a password via websockets
import { WebSocketGateway, SubscribeMessage } from '@nestjs/websockets';
import { Socket } from 'socket.io';
@WebSocketGateway(3000, {transports: ['websocket']})
export class AuthGateway {
@SubscribeMessage('auth')
handleEvent(client: Socket, auth: {username: "user2", password: "[email protected]#"}) {
return auth;
}
}
Answer the question
In order to leave comments, you need to log in
And there is a client application on port 3001
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question