简体   繁体   中英

php <-> node.js communication

What is the Best way to communicate in between'em when :-

  1. I need to restart node.js app (or Update configs) from php

I do know about D-node. But is D-node good to use in my case ? I can have 100s of node.js apps

Your question is opinion based...

If you have a complex system with hundreds of applications in multiple languages (PHP + JS in your case)

  • Define messages so that they can communicate to each other.
  • Choose a common tool to serialize, unserialize messages (JSON, Avro, Protobuf, XML...)
  • Choose a messaging system that suits your needs (RabbitMQ, ZeroMQ, ActiveMQ, ...)
  • Decide which app does which task and a global messaging architecture with patterns that you did not invent (i like zmq documentation for that matter, but you should also read the RabbitMQ doc).

Another great tool is Celery (from the python world). You won't be able to use it, but its documentation is a very good read.

Everything else wont work. If you start having a PHP script restarting another one, that does some task, then calls a bash script, you will end up spending 10 times the effort debugging.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM