Easier interface to dnode.
eNode is a simple wrapper around DNode/upnode functionality, simplifying creation and operation of DNode servers and clients. I like DNode, I just found it used some strange patterns.
shutdownfunction will shut down both servers and clients (servers normally require a
end()while a client normally just needs a close().
// server.jsvar enode = require'enode'var api =callbacknull "server"var server = apilisten5000serveron'connect'console.log'new connection' connectionidremotewhoamiconsole.log'server connected to' valueconsole.log'connected clients' serverconnectionslengthserveron'disconnect'console.log'disconnection' connectionidconsole.log'connected clients' serverconnectionslength
// client.jsvar enode = require'enode'var api =callbacknull "client"var client = apiconnect5000clienton'ready'remotewhoamiconsole.log'client connected to' value