nodejs进程间通信

nodejs进程间通信常用的有4种方式

1. stdin/stdout    stdin和stdout可以传递json,双方在标准输入输出中读写json,但是进程间要知道对方的句柄,VS Code使用了这种方式
2. 原生IPC         on('message')和send,条件是进程间要知道对方的句柄
3. sockets         包括系统级的socket和网络级的socket,系统级的socket通常是采用文件系统,网络级socket通常是采用协议,TCP,UDP等。node-ipc实现多种形式的socket通信方式。
4. 消息队列        redis等

posted @ 2020-05-01 17:01  全玉  阅读(1371)  评论(0编辑  收藏  举报