-
Notifications
You must be signed in to change notification settings - Fork 17
2. Flowchain Node APIs
jollen chen edited this page Mar 30, 2018
·
1 revision
To start a boot node server:
var BootNode = require('./index').BootNode;
var node = new BootNode();
node.start();
-
options
<Object> Options containing response events.-
onstart
<function> Callback function that notifies the success of creating the Websocket connection. -
onmessage
<Function> Callback function that receives client data -
onquery
<Function> Callback function that receives client data -
ondata
<Function> Callback function that receives client data
-
Example:
// Start the boot node with event handlers
node.start({
onstart: onstart,
onmessage: onmessage,
onquery: onquery,
ondata: ondata
});
Example:
var onstart = function(req, res) {
// Chord node ID
var id = req.node.id;
// Node IP address
var address = req.node.address;
};