Complete the code to create a TCP client in NestJS.
const client = ClientProxyFactory.create({ transport: [1] });Transport.TCP is used to specify TCP transport in NestJS microservices.
Complete the code to set the TCP port to 3001.
const microserviceOptions = { transport: Transport.TCP, options: { port: [1] } };Port 3001 is set here to specify where the TCP microservice listens.
Fix the error in the TCP microservice creation by completing the missing import.
import { [1] } from '@nestjs/microservices';
Transport must be imported from '@nestjs/microservices' to configure TCP transport.
Fill in the blank to create a TCP microservice on port 4000.
const microservice = app.[1]Microservice({ transport: Transport.TCP, options: { port: 4000 } });
Use createMicroservice to create the microservice instance.
Fill all three blanks to send a message with pattern 'sum' and data {a: 5, b: 3} using the TCP client.
const client = ClientProxyFactory.create({ transport: Transport.TCP });
await client.[1]();
const result = await client.send({ cmd: '[2]' }, [3]).toPromise();First, connect the client with connect(), then send a message with pattern 'sum' and data object.
