Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/e0selmy4v/procomm
Simple file-to-file IPC framework
https://github.com/e0selmy4v/procomm
eventemitter events from-scpos inter-process-communication ipc light nodejs
Last synced: 1 day ago
JSON representation
Simple file-to-file IPC framework
- Host: GitHub
- URL: https://github.com/e0selmy4v/procomm
- Owner: E0SelmY4V
- License: mit
- Created: 2022-12-23T19:28:42.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-02-05T19:02:49.000Z (almost 2 years ago)
- Last Synced: 2024-11-16T17:08:12.177Z (about 1 month ago)
- Topics: eventemitter, events, from-scpos, inter-process-communication, ipc, light, nodejs
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/procomm
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Scpos Inter-Process Communication Library
*procomm* can make file-to-file IPC come ture.
Through elegant method chain, you can let the JS file running in different processes communicate alone with each other by "listen" and "tell".## Initialization
### CJS
```js
const procomm = require('procomm')(__filename);
```### ESM
```js
import procommIniter from 'procomm';
const procomm = procommIniter(import.meta.url);
```## Usage
Send message to JS file `./dad.js` running in father process:
```javascript
procomm.tell('dad', 'hello');
```Send message to `./folder/son.js` in child process:
```javascript
const subProce = child_process.fork(path.join(__dirname, 'folder/son'));
procomm.reProce(subProce).tell('folder/son', 'hello');
```Listen message from `../dad.js` in father process:
```javascript
procomm.listen('../dad', msg => console.log(msg));
```Listen message from `/home/test/son.js` in child process:
```javascript
const subProce = child_process.fork('/home/test/son');
procomm.reProce(subProce).listen('/home/test/son.js', msg => console.log(msg));
```