Intercommunication between nodejs processes

692 Views Asked by At

I'm working with two independent nodejs processes, the first one is an server over TCP, and the second is an express app that listen for HTTP requests. My problem is how can i handle the communication between those two processes?

1

There are 1 best solutions below

0
On

Plenty of options:

  • launch one process from another using child_process and communicate using stdin/stdout

  • have your express app also open a TCP connection to your TCP server (on a different port than the one already in use), and communicate via tcp/ip

  • communicate via HTTP, by implementing another API on your express server
  • use node-ipc, an inter-process communication module
  • use a message queue library like zeromq
  • communicate via a database: each process reads and writes to the same database
  • communicate using a plain text file: each process reads and writes to the file

I think the list could go on.