-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbroker.js
40 lines (30 loc) · 885 Bytes
/
broker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
var _ = require('lodash');
var mHub = require('./lib/mHub_beac.js');
var local_ip = "0.0.0.0"
// Temporary broker file. Need to retrofit this and a
// general JSON schema to mHub to replace this logic...
//
// For demo purposes only
// need to remove config requirement from mHub...
var config = {
logPath: "./logs/"
};
var hub = new mHub(config);
// bounce from here
hub.on('output', function(message) {
console.log(
"Received: [" + message.target.join(", ") + "] :"
+ JSON.stringify(message.data)
)
//if(message.target[0] === 'connected') {
// hub.emit(["assignEngine"], ['NewSession0', 'Deacon.js']);
//}
});
//
// require('dns').lookup(require('os').hostname(), function (err, add, fam) {
// local_ip = add;
// })
setTimeout(
function() {
hub.emit('input', {target: ["listen", "tcp"], data:[true, local_ip, 8008]});
}, 4000);