{"id":15528856,"url":"https://github.com/danielnieto/ipc-messages-manager","last_synced_at":"2026-04-28T08:37:23.461Z","repository":{"id":57276526,"uuid":"71101274","full_name":"danielnieto/ipc-messages-manager","owner":"danielnieto","description":"Manage parent/child process messaging to be used as functions with callbacks","archived":false,"fork":false,"pushed_at":"2017-03-21T23:33:56.000Z","size":5,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-13T23:51:34.279Z","etag":null,"topics":["child","communication","ipc","messages","nodejs","parent","processes"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danielnieto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-17T04:57:20.000Z","updated_at":"2022-12-08T23:50:30.000Z","dependencies_parsed_at":"2022-09-13T04:42:36.993Z","dependency_job_id":null,"html_url":"https://github.com/danielnieto/ipc-messages-manager","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/danielnieto/ipc-messages-manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielnieto%2Fipc-messages-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielnieto%2Fipc-messages-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielnieto%2Fipc-messages-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielnieto%2Fipc-messages-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielnieto","download_url":"https://codeload.github.com/danielnieto/ipc-messages-manager/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielnieto%2Fipc-messages-manager/sbom","scorecard":{"id":320209,"data":{"date":"2025-08-11","repo":{"name":"github.com/danielnieto/ipc-messages-manager","commit":"7db563a757f39d83a760acc5b91bffd48dd54c2e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/6 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-18T01:10:27.832Z","repository_id":57276526,"created_at":"2025-08-18T01:10:27.832Z","updated_at":"2025-08-18T01:10:27.832Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32373512,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T20:07:02.737Z","status":"online","status_checked_at":"2026-04-28T02:00:07.250Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["child","communication","ipc","messages","nodejs","parent","processes"],"created_at":"2024-10-02T11:15:21.160Z","updated_at":"2026-04-28T08:37:23.436Z","avatar_url":"https://github.com/danielnieto.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ipc-messages-manager\nManage communication between parent and child processes through IPC asynchronously in NodeJS.\n\n## Why?\n\nWhen trying to use child process' functions from the parent process, you need to set up a bunch of listeners on both sides, and if you need to get a response to a specific function call asynchronously forget about it. Listening for messages does not allow to identify which response corresponds to which request(call to a child's function).\n\nThis packages solves this problem, allows you to easily call a function on a child process spawned with `child_process.spawn()`, and have a `callback` for it.\n\n### Problem to solve:\n\n(on parent process)\n\n```js\nlet child = spawn(\"node\", [\"./child.js\"], {stdio:[\"pipe\", \"pipe\", \"pipe\", \"ipc\"]});\n\nchild.send(\"asyncRequest1\", \"doSomething\");\n\nchild.send(\"asyncRequest2\", \"doSomethingDifferent\");\n\nchild.on(\"message\", function(reponse){\n\n\t//this \"response\" is for asyncRequest1 or asyncRequest2???\n\tconsole.log(reponse);\n});\n\n```\n\n## How to use it?\n\n1.- Install it in your project:\n\n`npm install ipc-messages-manager -S`\n\n2.- Require it:\n\n* on parent process\n`var ipcManager_parent = require(\"ipc-messages-manager\").parent;`\n\n* on child process\n`var ipcManager_child = require(\"ipc-messages-manager\").child;`\n\n3.- Spawn the child process (on parent process)\n\n```js\nvar child = require(\"child_process\").spawn(\"node\", [\"./child-process.js\"], {stdio:[\"pipe\", \"pipe\", \"pipe\", \"ipc\"]});\n\n```\n\n4.- Send message from the parent to child:\n\n```js\nipcManager_parent.send(child, \"actionToPerform\", {param1:\"foo\", param2:\"bar\"}, function(result){\n        console.log(\"response to this message was \" + result);\n    });\n```\n\n5.- Listen for this message on the child, and provide an answer to it:\n\n```js\nipcManager_child.actions.on(\"actionToPerform\", function(args, callback){\n\tvar result = doProcess(args.param1, args.param2);\n\tcallback(result);\n});\n```\n\nor, register a function to be called for each action, all at once:\n\n```js\nipcManager_child.setActions({\n\t\"actionToPerform\": function(args, callback){\n\t\tvar result = doProcess(args.param1, args.param2);\n\t\tcallback(result);\n\t},\n\t\"secondActionToPerform\": function(args, callback){\n\t\tdoAsyncProcess(args.param1, function(result){\n\t\t\tcallback(result);\n\t\t});\n    }\n});\n```\n\n## Parent's API\n### send(child, action, args, callback)\n\n#### child\nType: `child_process` \u003cbr\u003e\n\nThe child process to whom it will send the message, it should be a process spawned with `child_process.spawn()` method and with an IPC channel already setup\n\n#### action\nType: `String` \u003cbr\u003e\n\nA string to identify the action that needs to be performed on the child instance and answer back to the parent. For example, let's say the child has a `addTwoNumbers()` function and the parent wants to call it, then it is suggested to set `action` to be `addTwoNumbers` to make logical sense, but it's not required.\n\n#### args\nType: `Object` \u003cbr\u003e\n\nAn object containing the arguments needed to perform \"action\". These arguments can later be retrieved on the child's listener function. In the example above for action `addTwoNumbers`, this `args` object could be something like `{number1: 5, number2: 10}`.\n\n### callback([response])\nType: `Function` \u003cbr\u003e\n\nFunction to be called when the child responds back with an answer to this action(message)\n\nThe `response` object will be what the child sent back.\n\n## Child's API\n\n### setActions(actions)\n\n#### actions\nType: `Object` \u003cbr\u003e\n\nAn object containing each action as keys and the value is the function that's going to be executed when that action is requested.\n\nEach function takes 2 parameters, the first one is the `args` object which contains all arguments (or parameters) for the action requested, and the second one is the `callback` that needs to be called to return the response back to the parent.\n\n\u003cbr\u003e\nExample:\n\n```js\nvar actions = {\naddTwoNumbers: function(args, callback){\n\t\t\t\t\t\tvar sum = addTwoNumbers(args.number1, args.number2);\n\t\t\t\t\t\tcallback(sum);\n\t\t\t\t\t},\nanotherAction: function(argsm callback){\n\t\t\t\t\t\tcallback(\"anotherAction performed\");\n\t\t\t\t\t},\n...\n}\n```\n\n### ipcManager_child.actions\n\nAlternatively you can listen (and respond) for specific actions with the `ipcManager_child.actions` EventEmitter by listening with the `on` method in the following way:\n\n```js\nipcManager_child.actions.on(\"addTwoNumbers\", function(args, callback){\n\tvar sum = addTwoNumbers(args.number1, args.number2);\n\tcallback(sum);\n});\n```\n\n## Questions\nFeel free to open Issues to ask questions about using this package, PRs are very welcome and encouraged.\n\n**SE HABLA ESPAÑOL**\n\n## License\n\nMIT © Daniel Nieto\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielnieto%2Fipc-messages-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielnieto%2Fipc-messages-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielnieto%2Fipc-messages-manager/lists"}