{"id":24738646,"url":"https://github.com/zweifisch/rpc.io","last_synced_at":"2025-03-22T18:42:52.224Z","repository":{"id":17895159,"uuid":"20846558","full_name":"zweifisch/rpc.io","owner":"zweifisch","description":"rpc over socket.io, with promise","archived":false,"fork":false,"pushed_at":"2016-02-03T12:59:27.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-27T22:55:08.956Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CoffeeScript","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/zweifisch.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":"2014-06-15T02:37:06.000Z","updated_at":"2016-01-23T06:44:14.000Z","dependencies_parsed_at":"2022-07-10T06:47:12.513Z","dependency_job_id":null,"html_url":"https://github.com/zweifisch/rpc.io","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/zweifisch%2Frpc.io","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zweifisch%2Frpc.io/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zweifisch%2Frpc.io/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zweifisch%2Frpc.io/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zweifisch","download_url":"https://codeload.github.com/zweifisch/rpc.io/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245006649,"owners_count":20546136,"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":[],"created_at":"2025-01-27T22:55:12.836Z","updated_at":"2025-03-22T18:42:52.187Z","avatar_url":"https://github.com/zweifisch.png","language":"CoffeeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rpc.io\n\n[![NPM Version][npm-image]][npm-url]\n\nrpc over socket.io\n\n## usage\n\nclientside:\n\n```javascript\nlet rpc = require('rpc.io-client')(socket, 2000);  # timeout\n\nrpc.call('users.get', {id: 1024}) # Promise\n```\n\nserverside:\n\n```javascript\nio.on('connection', (socket)=\u003e {\n\n    rpc = require(\"rpc.io\")(socket);\n\n    rpc.register('users.get', (id)=\u003e {nickname: 'foo'});\n\n    rpc.register('users', {\n        delete: function*(id) {\n            yield db.items.remove({owner: id});\n            db.users.remove({_id: id});\n        }\n    });\n});\n```\n\n### optional params\n\n```javascript\nrpc.register('projects.create', {description: ''}, (name, description)=\u003e);\n```\n\n```javascript\nsocket.register('projects', {\n    create_defaults: {\n        description: ''\n    },\n    create: (name, description)=\u003e\n});\n```\n\n### handle all rpc calls\n\n```javascript\nrpc.on(\"call\", (method, kwargs)=\u003e throw Error `method ${method} not implemented`);\n```\n\n### handle errors\n\n```javascript\nrpc.on(\"error\", (method, kwargs, error)=\u003e log.error(error));\n```\n\n[npm-image]: https://img.shields.io/npm/v/rpc.io.svg?style=flat\n[npm-url]: https://npmjs.org/package/rpc.io\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzweifisch%2Frpc.io","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzweifisch%2Frpc.io","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzweifisch%2Frpc.io/lists"}