Skip to content

A client that allows you to send messages to a Nest.js microservice (TCP).

License

Notifications You must be signed in to change notification settings

huagaojian/nestjs-custom-tcp-client

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nest.js Custom TCP Client

Problematic

Nest.js microservices can communicate with each other using different transports. It has its own server and client implementations and there is no example of how to send messages NOT using Nest.js.

But what if we have the legacy current codebase, and we're not ready to rewrite it with Nest.js yet?

Description

This repository contains a custom TCP client written using TypeScript and Node.js which can communicate with the Nest.js TCP server.

It's not perfect, I personally think of it more as a proof of concept.

Notes

Reverse engineering showed that Nest.js uses the following TCP message format:

# {length}{delimiter}{data}

75#{"pattern":"example","data":{},"id":"ce51ebd3-32b1-4ae6-b7ef-e018126c4cc4"}

ID (data.id) is used for message pattern strategy (MessagePattern), without it, Nest.js treats the message as an event (EventPattern).

Credits

About

A client that allows you to send messages to a Nest.js microservice (TCP).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%