Flowhub Runtime Registry library
This library provides easy access to the Flowhub runtime registry. It is intended to be used by Flow-Based Programming Protocol compatible clients to register themselves available for Flowhub users.
Usage:
const flowhub = require('flowhub-registry');
const rt = new flowhub.Runtime({
label: 'My home NoFlo system',
id: '754c5dc0-97e9-11e3-a5e2-0800200c9a66',
user: '89454800-97e9-11e3-a5e2-0800200c9a66',
protocol: 'websocket',
address: 'ws://some.server.address:3569',
type: 'noflo-nodejs',
secret: 'C6sxubeP22u4'
});
rt.register(function (err, ok) {
if (err) {
alert('Registration failed');
}
});
In addition to registering the runtime, it is a good idea to periodically ping Flowhub to let the user know that the runtime is still available.
setInterval(function () {
rt.ping();
}, 5 * 60 * 1000);
If you have access to the user's OAuth token you can also remove a registered runtime:
rt.del('nch9138ohf2892fhgf92g8f942fh2938gf3', function (err, ok) {
});