{"id":16830816,"url":"https://github.com/jpillora/pnode","last_synced_at":"2025-04-11T04:11:17.071Z","repository":{"id":10091639,"uuid":"12151796","full_name":"jpillora/pnode","owner":"jpillora","description":"peer-to-peer dnode over anything!","archived":false,"fork":false,"pushed_at":"2014-03-06T14:18:57.000Z","size":3960,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"gh-pages","last_synced_at":"2025-03-24T23:18:39.641Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/jpillora.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":"2013-08-16T05:56:37.000Z","updated_at":"2019-07-06T18:20:09.000Z","dependencies_parsed_at":"2022-09-21T02:01:21.748Z","dependency_job_id":null,"html_url":"https://github.com/jpillora/pnode","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpillora%2Fpnode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpillora%2Fpnode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpillora%2Fpnode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpillora%2Fpnode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jpillora","download_url":"https://codeload.github.com/jpillora/pnode/tar.gz/refs/heads/gh-pages","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248339224,"owners_count":21087215,"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":"2024-10-13T11:41:10.464Z","updated_at":"2025-04-11T04:11:17.053Z","avatar_url":"https://github.com/jpillora.png","language":"JavaScript","readme":"***In progress - API Unstable!***\n\n--------------\n\n# \u003cname\u003epnode\u003c/end\u003e\n\n\u003cdescription\u003epeer-to-peer dnode over anything!\u003c/end\u003e\n\n[![NPM version](https://nodei.co/npm/pnode.png?compact=true)](https://npmjs.org/package/pnode)\n\nNode tests:\n\n[![Build Status](https://travis-ci.org/jpillora/pnode.png)](https://travis-ci.org/jpillora/pnode)\n\nBrowser tests:\n\n[![browser support](https://ci.testling.com/jpillora/pnode.png)](https://ci.testling.com/jpillora/pnode)\n\n## Summary\n\n**pnode** is a Node.js library, built ontop of dnode ([What's dnode?](http://substack.net/doc/dnode_slides_nodeconf.pdf)),\nallows applications (node and browser) to easily communicate in a peer-to-peer fashion. Since there's no centralised server,\nthere's no single point of failure, this ability simplifies the implementation of *resilient* applications by adding\n*redundancy*.\n\n## Features\n\n* Simplified [dnode](https://github.com/substack/dnode) API \n* Autoreconnects and buffering **like** [upnode](https://github.com/substack/upnode)\n* Easily utilise different transports\n* Usable in the browser with the Websockets transport\n* Create your own transport types with any duplex stream\n\n## Future Features\n\n* Client function call timeouts\n* Integration with [cluster](http://nodejs.org/api/cluster.html)\n* Peer-to-Peer API\n  * Each instance is a server and many clients\n* Authentication\n  * Password\n  * Certificates\n  * [ACL](http://en.wikipedia.org/wiki/Access_control_list)\n* Proxying RPC\n  * Allowing `client` can communicate with `server2` via `server1` (`client`↔`server1`↔`server2`)\n  * Achieved by `expose()`ing another `server`/`client`\n* WebRTC transport `rtc://` to provide `client`↔`client` networks\n\n## Download\n\n\u003ccodeBlock(\"npm install \" + name)\u003e\n```\nnpm install pnode\n```\n\u003c/end\u003e\n\n***Note: Only node `v0.10.x` is currently supported***\n\n## Basic Usage\n\nServer:\n\u003cshowFile(\"example/basic/https/server.js\")\u003e\n``` javascript\nvar pnode = require('../../../');\nvar server = pnode.server();\n\nserver.expose({\n  say: function(date) {\n    console.log('client says ' + date);\n  }\n});\n\nserver.bind('https://0.0.0.0:8000', function(){\n  console.log('bound to all interfaces on port 8000');\n});\n```\n\u003c/end\u003e\n\nClient:\n\u003cshowFile(\"example/basic/https/client.js\")\u003e\n``` javascript\nvar pnode = require('../../../');\nvar client = pnode.client();\n\nclient.bind('https://localhost:8000');\n\nclient.server(function(remote) {\n  remote.say(new Date());\n});\n\n```\n\u003c/end\u003e\n\nYou can use a different transport by simply changing the URI. Currently,\nthe following transports are avaiable:\n\n* `tcp`\n* `tls`\n* `http`\n* `https`\n* `ipc` (unix sockets)\n* `ws` (websockets)\n\nSee [basic examples](example/basic/)\n\n## Browser Usage\n\nSee [browser examples](example/browser/)\n\nSee [this demo](http://pnode-browser-demo.herokuapp.com/) ('long-polling-heroku' in the examples),\nsince Heroku doesn't support Websockets, sockjs falls back to\n[XHR long polling](http://en.wikipedia.org/wiki/Comet_(programming))\nwith [shoe](https://github.com/substack/shoe) maintaining stream-like behaviour.\n\n## API\n\nSee [API docs](docs/pnode-api.md/)\n\n\n\n## Advanced Usage\n\n#### `server.handle`\n\nInstead of `server.listen()`, you can\nprovide the streams to `server.handle()`:\n\n``` javascript\n// handle a read and write stream\nfoo(function(req, res) {\n  server.handle(req, res);\n});\n// OR\n// handle a duplex stream\nbar(function(stream) {\n  server.handle(stream);\n});\n```\n\nEach call to `server.handle()` will be seen as a new\nclient by the server.\n\n#### `client.createConnection`\n\nInstead of `client.connect()`, you can provide a\nfunction which will asynchronously create \nconnection streams:\n\n``` javascript\n// create a read and a write stream\nclient.createConnection(function(readCallback, writeCallback) {\n  readCallback(foo.createReadStream());\n  writeCallback(bar.createWriteStream());\n});\n// OR\n// create a duplex stream\nclient.createConnection(function(streamCallback) {\n  streamCallback(bar.createStream());\n});\n```\n\nThis will get called to whenever \u003cname\u003epnode\u003c/end\u003e\nneeds to restablish a connection.\n\n\u003clicense()\u003e\n#### MIT License\n\nCopyright \u0026copy; 2013 Jaime Pillora \u0026lt;dev@jpillora.com\u0026gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\u003c/end\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpillora%2Fpnode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpillora%2Fpnode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpillora%2Fpnode/lists"}