haba.dnode

0.1.0 • Public • Published

Notes

  • ALL dnode functions must follow the cb(err, result) pattern. If a host disconnects for whatever reason, all remote functions return an error in the first parameter.

Usage

server.js

var plugin = require("plugin");

plugin().
use(require("plugin-dnode").server({
	auth: function(credentials, callback) {
		if(credentials.user == "user" && credentials.pass == "pass") return callback();
		return callback(new Error("unauthorized"));
	}
})).
require({
	name: "hello",
	plugin: function() {
		return {
			say: function(callback) {
				callback("hello!");
			}
		};
	}
}).
load();

client.js

var plugin = require("plugin");

plugin().
use(require("plugin-dnode").client()).
require("dnode://user:pass@localhost:5004").
load(function(err, exports) {
	exports.hello.say(function(message) {
		console.log(message);//hello!
	})
});

Readme

Keywords

none

Package Sidebar

Install

npm i haba.dnode

Weekly Downloads

2

Version

0.1.0

License

none

Last publish

Collaborators

  • architectd
  • crcn