{"id":22197376,"url":"https://github.com/ecwyne/hydra-plugin-rpc","last_synced_at":"2025-07-27T01:31:08.216Z","repository":{"id":57269847,"uuid":"88678124","full_name":"ecwyne/hydra-plugin-rpc","owner":"ecwyne","description":"Hydra-RPC Plugin for Hydra microservices library","archived":false,"fork":false,"pushed_at":"2017-05-18T17:37:52.000Z","size":10,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-16T05:49:54.170Z","etag":null,"topics":["hydra","hydra-plugin","microservices"],"latest_commit_sha":null,"homepage":"https://www.hydramicroservice.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ecwyne.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-18T23:06:23.000Z","updated_at":"2022-05-07T14:13:12.000Z","dependencies_parsed_at":"2022-09-02T12:31:22.467Z","dependency_job_id":null,"html_url":"https://github.com/ecwyne/hydra-plugin-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/ecwyne%2Fhydra-plugin-rpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecwyne%2Fhydra-plugin-rpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecwyne%2Fhydra-plugin-rpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecwyne%2Fhydra-plugin-rpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ecwyne","download_url":"https://codeload.github.com/ecwyne/hydra-plugin-rpc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227740652,"owners_count":17812687,"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":["hydra","hydra-plugin","microservices"],"created_at":"2024-12-02T14:19:23.220Z","updated_at":"2024-12-02T14:19:23.918Z","avatar_url":"https://github.com/ecwyne.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hydra-plugin-RPC\nCreate and consume [remote procedure calls](https://en.wikipedia.org/wiki/Remote_procedure_call) in [hydra](https://github.com/flywheelsports/hydra) with ease.\n\n## Install\n```shell\n$ npm i --save hydra-plugin-rpc\n```\n## Use\nTwo methods are added to the hydra instance to add or consume methods\n```javascript\n// hydra.methods(obj: Object);\n// Object has keys of method names and values of functions.\nhydra.methods({\n    methodName: (arg1, arg2, arg3) =\u003e arg1 + arg2; // return value or Promise\n});\n```\n\n```javascript\n// hydra.call(methodName: String, ...arguments) =\u003e Promise\n// First argument is method name.\n// Remaining arguments are sent to method (must be serializable).\n// Returns a promise with the result.\nhydra.call('methodName', arg1, arg2, arg3).then(...);\n```\n\n## Example\n```javascript\n// Service1.js\nconst hydra = require('hydra');\nconst HydraRPC = require('hydra-plugin-rpc');\nconst Promise = require('bluebird');\n\nhydra.use(new HydraRPC());\n\nhydra.init({...}).then(() =\u003e {\n  hydra.methods({\n    ping: () =\u003e 'pong',\n    sleepPing: delay =\u003e Promise.resolve('pong').delay(delay) // optionally return promises\n  });\n});\n```\n\n```javascript\n// Service2.js (even works on separate machines!)\nconst hydra = require('hydra');\nconst HydraRPC = require('hydra-plugin-rpc');\n\nhydra.use(new HydraRPC());\n\nhydra.init({...}).then(() =\u003e {\n  hydra.call('ping').then(result =\u003e console.log(result)); // Logs \"pong\"!\n  hydra.call('sleepPing', 1000).then(result =\u003e console.log(result)); // Result comes back after 1000 ms!\n});\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecwyne%2Fhydra-plugin-rpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fecwyne%2Fhydra-plugin-rpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecwyne%2Fhydra-plugin-rpc/lists"}