A partially connected mesh network with messaging and discovery.
There are many solutions for service discovery for Node. Solidipes provides node discovery and low latency message routing to serve as a foundation for distributed service discovery.
Run any of the following:
$ mocha$ npm test$ make test
Note: remember to
$ npm install solidipes
Solidipes exports a Network constructor.
var Network = ;var id = ;var net =// auto-generated if not includedid: id// listen on port 3000, defaults to a random open portport: 3000;
Create a new network instance.
var net =// defaults to an auto-generated 32-digit hex string, provide this if usefulid: 'a94312d853e585bc41c1ff990f120b1b'// the interval on which to garbage collect the seen messages structurecleanup: 10000 // default// the host to bind the server to, finds an external address if not providedhost: 'localhost'// the port to listen on, defaults to a random open portport: 3000// number of neighbor nodes to keep in contact withlocals: 8 // default;
Returns the formatted transport connection info.
Seed the network with transport info, which can be retrieved back calling
// get the transport infovar info = network;// broadcast the info to another process somehow// seed the network with the remote transport infonet;
Gets the size of the network in number of nodes.
netsize; // => 0
Specifies the recipient and options of an event emit. If target is null, designates a global broadcast.
// broadcast to everybody! (realistically just do .emit)net;// unicast to the specified nodenet;// multicast to two nodesnet;// direct-unicast to the specified node (must be a neighbor node)net;// the redundant option specifies how much the message should be replicated// higher numbers mean the message has a high likelyhood of reaching its destination// lower numbers mean fewer wasted packetsnet;
Broadcast an event to all nodes in the network.
Emitted when a node is added to the network, either manually or through node discovery.
Emitted when a node is removed from the network.
Emitted as message records are cleaned up on the provided interval.
General error event, usually emitted during parse. Make sure you also add an error listener on the transport.
Emitted when solidipes receives a valid but unknown packet.
Emit an event to the represented Target (returned by
Okay. Many flaws fixed, still no roadmap.
The MIT License (MIT)
Copyright © 2014 GlobeSherpa
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.