aud-socket-client
v1.1.0
Published
## Install npm i aud-socket-server npm i aud-socket-client
Downloads
3
Readme
aud-socket-server && aud-socket-client
Install
npm i aud-socket-server
npm i aud-socket-client
Use
var socketServer = require('aud-socket-server').server('test-service', 8124);// namespace port
socketServer.use('methodName', function(req, res) {
console.log(req); //'test from client'
res.send(null, 'test from server');
});
var socketClient = require('aud-socket-client').client('test-service', [{host:'127.0.0.1',port:8124}]);// namespace config(list of servers)
var timeout = 500; //ms
socketClient.connect(function(err) {
if(err)
throw err;
socketClient.send('methodName', 'test from client', function(err, result){
console.log(result); //'test from server'
}, timeout);
});