{"id":16758461,"url":"https://github.com/kessler/node-xn","last_synced_at":"2026-02-27T07:43:12.445Z","repository":{"id":142618777,"uuid":"61754883","full_name":"kessler/node-xn","owner":"kessler","description":"a distilled engine for creating RPC Servers/Clients","archived":false,"fork":false,"pushed_at":"2018-01-26T22:58:47.000Z","size":28,"stargazers_count":9,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-08T18:18:55.281Z","etag":null,"topics":[],"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/kessler.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":"2016-06-22T22:11:44.000Z","updated_at":"2019-07-15T17:37:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"b980de51-5a54-435d-8582-6964c8657d8d","html_url":"https://github.com/kessler/node-xn","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/kessler/node-xn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kessler%2Fnode-xn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kessler%2Fnode-xn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kessler%2Fnode-xn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kessler%2Fnode-xn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kessler","download_url":"https://codeload.github.com/kessler/node-xn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kessler%2Fnode-xn/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29887795,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T05:38:26.446Z","status":"ssl_error","status_checked_at":"2026-02-27T05:38:25.235Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-10-13T04:05:25.352Z","updated_at":"2026-02-27T07:43:12.417Z","avatar_url":"https://github.com/kessler.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xn\n\n**a distilled engine for creating RPC Servers/Clients**\n\n- Expose any kind of async api, including whole modules, remotely\n- Use any kind of transport layer that supports request/response semantics\n- Expose different versions of the same api using semver\n\n[![npm status](http://img.shields.io/npm/v/xn.svg?style=flat-square)](https://www.npmjs.org/package/xn) \n\n## example\n\n### expose core filesystem module using axon\n```\nnpm init\nnpm i --save xn axon\n```\n\n```js\nconst xn = require('./index')\nconst axon = require('axon')\n\n// create the rpc server\nlet server = new xn.RpcServer()\nserver.requireApiModule('fs')\nserver.addApiFunction('moo', (a, reply) =\u003e {\n    reply(null, a + 'b')\n})\n\nlet myApi = {\n    ping: reply =\u003e reply(null, 'pong'),\n    echo: (what, reply) =\u003e reply(null, what)\n}\nserver.addApiModule('meow', myApi)\n\n// create the axon sockets\nlet rep = axon.socket('rep')\nlet req = axon.socket('req')\n\nrep.bind(3000)\nreq.connect(3000)\n\nrep.on('message', (message, reply) =\u003e {\n    // integrate xn server with axon\n    server.dispatch(message, reply)\n})\n\n// create the rpc client\nlet client = new xn.RpcClient({\n    send: (message, cb) =\u003e {\n        // integrate xn client with axon\n        req.send(message, cb)\n    }\n})\n\n// expose the remote calls on a local object\nclient.refresh((err, rpc) =\u003e {\n    if (err) return done(err)\n\n    // rpc === client.rpc\n    rpc.fs.writeFile('myfile', 'test', (err) =\u003e {\n        console.log(err ? err : 'success')\n    })\n})\n\n// it is possible to skip the refresh() stage and send an api call immediately:\nlet message = {\n    apiName: 'fs',\n    propertyName: 'writeFile',\n    args: ['myfile', 'test']\n}\n\nclient.sendMessage(message, (err) =\u003e {\n    console.log(err ? err : 'success')\n})\n```\nFor further examples see [this test](/test/integration.test.js)\n\n## api \n## license\n\n[MIT](http://opensource.org/licenses/MIT) © yaniv kessler\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkessler%2Fnode-xn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkessler%2Fnode-xn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkessler%2Fnode-xn/lists"}