{"id":20277529,"url":"https://github.com/udamir/node-ipc-rpc","last_synced_at":"2025-03-04T01:42:30.469Z","repository":{"id":103392462,"uuid":"399262736","full_name":"udamir/node-ipc-rpc","owner":"udamir","description":"IPC and RPC service for nodes in scalable application","archived":false,"fork":false,"pushed_at":"2021-08-23T22:23:56.000Z","size":56,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-14T06:47:48.357Z","etag":null,"topics":["ipc","redis","rpc"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/udamir.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-23T22:20:23.000Z","updated_at":"2024-12-07T10:54:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"119c578d-e172-46b7-887b-d112cdb9bb09","html_url":"https://github.com/udamir/node-ipc-rpc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/udamir%2Fnode-ipc-rpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/udamir%2Fnode-ipc-rpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/udamir%2Fnode-ipc-rpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/udamir%2Fnode-ipc-rpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/udamir","download_url":"https://codeload.github.com/udamir/node-ipc-rpc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241768288,"owners_count":20017129,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["ipc","redis","rpc"],"created_at":"2024-11-14T13:18:49.446Z","updated_at":"2025-03-04T01:42:30.446Z","avatar_url":"https://github.com/udamir.png","language":"TypeScript","readme":"# node-ipc-rpc\n\nInternal process communication (IPC) and Remote procedure calls (RPC) service for nodes of scalable application.\nNodes discovery and communication can be handled by Redis.\n\n# When it required?\nWhen scaled nodes need\n1. discover other instances\n2. send messages to instance or all instances (broadcast)\n3. call remote function on instance and get result\n\n# Quick start\n\n## Installation\n\n```\nnpm install --save node-ipc-rpc ioredis\n```\n\n## Create IPC via Redis \n\n```ts\nimport Redis from \"ioredis\"\nimport { RedisIpc } from \"node-ipc-rpc\"\n\nconst redis = new Redis(\"redis://127.0.0.1:6379\")\nconst pid = Date.now().toString(24)\n\n// declare methods for all node instances\ninterface Methods {\n  sum: (a: number, b: number) =\u003e Promise\u003cnumber\u003e\n}\n\nconst ipc = new RedisIpc\u003cMethods\u003e(redis, pid)\n\nipc.declare(\"sum\", (a: number, b: number) =\u003e a + b)\n\n// handle instance connection\nipc.on(\"connect\", async (node) =\u003e {\n  const result = await node.sum(1, 2)\n  console.log(result) // 3\n})\n\n// handle incoming messages\nipc.on(\"test\", (node, data) =\u003e {\n  console.log(data) // \"message\" on other instances\n})\n\n// send message to all instances (self exclusive)\nipc.sendAll(\"test\", \"message\")\n\n\n// gracefull shutdown\nipc.close()\n```\n\n# License\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fudamir%2Fnode-ipc-rpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fudamir%2Fnode-ipc-rpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fudamir%2Fnode-ipc-rpc/lists"}