Search code examples
websockettcpmicroservicesnestjstcpclient

How to connect and read response from microservice(TCP) in socket.io


In Nest.js, I am using tcp architecture for microservice communication, in socket.io connection, I am able connect the microservice as show below but I am not able to read the response.

this.client.emit<any, any>('getSingleRoom', payload);

this.client.send({ service: 'getSingleRoom' }, payload).toPromise();

Both the code connect with microservice but, I am not able to read out this response so that I can emit in main server. I am using web socket in nest.js.


Solution

  • this.client.send<any, any>('sendMessagesInRoom', pay).toPromise();