In progress - API Unstable!
peer-to-peer dnode over anything!
pnode is a Node.js library, built ontop of dnode (What's dnode?), allows applications (node and browser) to easily communicate in a peer-to-peer fashion. Since there's no centralised server, there's no single point of failure, this ability simplifies the implementation of resilient applications by adding redundancy.
clientcan communicate with
<codeBlock("npm install " + name)>
npm install pnode
Note: Only node
v0.10.x is currently supported
var pnode = ;var server = pnode;server;server;
var pnode = ;var client = pnode;client;client;
You can use a different transport by simply changing the URI. Currently, the following transports are avaiable:
See basic examples
See browser examples
See API docs
server.listen(), you can
provide the streams to
// handle a read and write stream;// OR// handle a duplex stream;
Each call to
server.handle() will be seen as a new
client by the server.
client.connect(), you can provide a
function which will asynchronously create
// create a read and a write streamclient;// OR// create a duplex streamclient;
This will get called to whenever pnode needs to restablish a connection.
<license()> #### MIT License
Copyright © 2013 Jaime Pillora <email@example.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.