Nearly functional uci base module

supports one each unix tcp sockets and clients in any combination with default and custom packet processing
master
David Kebler 2018-01-18 21:32:07 -08:00
parent c3e94b465e
commit 3015798068
21 changed files with 2375 additions and 302 deletions

View File

@ -9,9 +9,10 @@ module.exports = {
"node": true, "node": true,
"mocha": true "mocha": true
}, },
"parser": "babel-eslint",
"parserOptions": { "parserOptions": {
"ecmaVersion": 2017, "ecmaVersion": 2017
"sourceType": "module" ,"sourceType": "module"
}, },
"extends": "eslint:recommended", "extends": "eslint:recommended",
"rules": { "rules": {

3
examples/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
*.log
*.sock
/node_modules/

64
examples/dual-server.mjs Normal file
View File

@ -0,0 +1,64 @@
import Base from '../src/base'
const USOCKET = __dirname + '/sample.sock'
const delay = time => new Promise(res=>setTimeout(()=>res(),time))
;
(async () => {
let app = new Base({com:'us,uc,ts,tc', tspp:'tcpProcess', id:'example', path: USOCKET, log:false})
// use an alternative packet processor for tcp
app.tcpProcess = async function (packet) {
if (!packet.cmd) return {error: 'no command in packet', packet: packet }
if (!this[packet.cmd]) return {error: 'no processing function supplied for command', packet: packet }
return await this.tcp[packet.cmd](packet)
}
app.echo = async packet => {
packet.processed = true
packet.cmd = 'res'
console.log('ECHO!')
return packet
}
app.tcp = {}
app.tcp.echo = async packet => {
packet.processed = true
packet.info = 'via tcp processor and echo'
packet.cmd = 'res'
console.log('TCP ECHO!')
return packet
}
app.write = async packet => {
console.log('packet with write command data received by server')
packet.cmd = 'res'
packet.processed = 'true'
packet.data = 'response from write'
return packet
}
app.res = async packet => {
console.log('==============Packet returned from server==========')
console.dir(packet)
console.log('===========================')
}
await app.init(app)
console.log('=============sending============')
let packet = {cmd:'echo', data:'some data to echo'}
app.send(packet)
// await delay(1000)
// packet = {cmd:'echo', data:'some MORE data to echo'}
// app.send(packet)
// // await delay(1000)
// packet = {cmd:'echo', data:'YET some data to echo'}
// app.send(packet)
})().catch(err => {
console.error('FATAL: UNABLE TO START SYSTEM!\n',err)
})

190
examples/package-lock.json generated Normal file
View File

@ -0,0 +1,190 @@
{
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"@uci/socket": {
"version": "0.1.0",
"resolved": "http://trantor:8082/@uci%2fsocket/-/socket-0.1.0.tgz",
"integrity": "sha512-2PoTfjLyYxIEd7zeoJyD0yUyQtICYPJBlmMrMP3U46FLtwWRntVu3fXKa0/gbbQYIwcWd24OK5CNvDeNdoa6cw==",
"requires": {
"better-try-catch": "0.6.2",
"bunyan": "1.8.12",
"death": "1.1.0",
"simple-node-logger": "0.93.33"
}
},
"balanced-match": {
"version": "1.0.0",
"resolved": "http://trantor:8082/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
},
"better-try-catch": {
"version": "0.6.2",
"resolved": "http://trantor:8082/better-try-catch/-/better-try-catch-0.6.2.tgz",
"integrity": "sha512-Ihghrm64n0sMiqZxA959Fism7/eDVgszfaLFpotZGGmDJc0EbpymhpkuA/OuTQ/BKMWZA6I68v3TVcnHBp7hXQ==",
"requires": {
"is-promise": "2.1.0"
}
},
"brace-expansion": {
"version": "1.1.8",
"resolved": "http://trantor:8082/brace-expansion/-/brace-expansion-1.1.8.tgz",
"integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=",
"requires": {
"balanced-match": "1.0.0",
"concat-map": "0.0.1"
}
},
"bunyan": {
"version": "1.8.12",
"resolved": "http://trantor:8082/bunyan/-/bunyan-1.8.12.tgz",
"integrity": "sha1-8VDw9nSKvdcq6uhPBEA74u8RN5c=",
"requires": {
"dtrace-provider": "0.8.6",
"moment": "2.20.1",
"mv": "2.1.1",
"safe-json-stringify": "1.0.4"
}
},
"concat-map": {
"version": "0.0.1",
"resolved": "http://trantor:8082/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"death": {
"version": "1.1.0",
"resolved": "http://trantor:8082/death/-/death-1.1.0.tgz",
"integrity": "sha1-AaqcQB7dknUFFEcLgmY5DGbGcxg="
},
"dtrace-provider": {
"version": "0.8.6",
"resolved": "http://trantor:8082/dtrace-provider/-/dtrace-provider-0.8.6.tgz",
"integrity": "sha1-QooiOv4DQl0s1tY0f99AxmkDVj0=",
"requires": {
"nan": "2.8.0"
}
},
"glob": {
"version": "6.0.4",
"resolved": "http://trantor:8082/glob/-/glob-6.0.4.tgz",
"integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=",
"requires": {
"inflight": "1.0.6",
"inherits": "2.0.3",
"minimatch": "3.0.4",
"once": "1.4.0",
"path-is-absolute": "1.0.1"
}
},
"inflight": {
"version": "1.0.6",
"resolved": "http://trantor:8082/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
"requires": {
"once": "1.4.0",
"wrappy": "1.0.2"
}
},
"inherits": {
"version": "2.0.3",
"resolved": "http://trantor:8082/inherits/-/inherits-2.0.3.tgz",
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
},
"is-promise": {
"version": "2.1.0",
"resolved": "http://trantor:8082/is-promise/-/is-promise-2.1.0.tgz",
"integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o="
},
"lodash": {
"version": "4.17.4",
"resolved": "http://trantor:8082/lodash/-/lodash-4.17.4.tgz",
"integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4="
},
"minimatch": {
"version": "3.0.4",
"resolved": "http://trantor:8082/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"requires": {
"brace-expansion": "1.1.8"
}
},
"minimist": {
"version": "0.0.8",
"resolved": "http://trantor:8082/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
},
"mkdirp": {
"version": "0.5.1",
"resolved": "http://trantor:8082/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"requires": {
"minimist": "0.0.8"
}
},
"moment": {
"version": "2.20.1",
"resolved": "http://trantor:8082/moment/-/moment-2.20.1.tgz",
"integrity": "sha512-Yh9y73JRljxW5QxN08Fner68eFLxM5ynNOAw2LbIB1YAGeQzZT8QFSUvkAz609Zf+IHhhaUxqZK8dG3W/+HEvg=="
},
"mv": {
"version": "2.1.1",
"resolved": "http://trantor:8082/mv/-/mv-2.1.1.tgz",
"integrity": "sha1-rmzg1vbV4KT32JN5jQPB6pVZtqI=",
"requires": {
"mkdirp": "0.5.1",
"ncp": "2.0.0",
"rimraf": "2.4.5"
}
},
"nan": {
"version": "2.8.0",
"resolved": "http://trantor:8082/nan/-/nan-2.8.0.tgz",
"integrity": "sha1-7XFfP+neArV6XmJS2QqWZ14fCFo="
},
"ncp": {
"version": "2.0.0",
"resolved": "http://trantor:8082/ncp/-/ncp-2.0.0.tgz",
"integrity": "sha1-GVoh1sRuNh0vsSgbo4uR6d9727M="
},
"once": {
"version": "1.4.0",
"resolved": "http://trantor:8082/once/-/once-1.4.0.tgz",
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"requires": {
"wrappy": "1.0.2"
}
},
"path-is-absolute": {
"version": "1.0.1",
"resolved": "http://trantor:8082/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
},
"rimraf": {
"version": "2.4.5",
"resolved": "http://trantor:8082/rimraf/-/rimraf-2.4.5.tgz",
"integrity": "sha1-7nEM5dk6j9uFb7Xqj/Di11k0sto=",
"requires": {
"glob": "6.0.4"
}
},
"safe-json-stringify": {
"version": "1.0.4",
"resolved": "http://trantor:8082/safe-json-stringify/-/safe-json-stringify-1.0.4.tgz",
"integrity": "sha1-gaCY9Efku8P/MxKiQ1IbwGDvWRE="
},
"simple-node-logger": {
"version": "0.93.33",
"resolved": "http://trantor:8082/simple-node-logger/-/simple-node-logger-0.93.33.tgz",
"integrity": "sha512-ppFuaDeacR1Vu+cP17kwOWQsx5C1vbIRa54qm5WgZBzQ5eBue/GWsDd4sr++ITnWZIoIOvjx5kEm5AhP7IqU+Q==",
"requires": {
"lodash": "4.17.4",
"moment": "2.20.1"
}
},
"wrappy": {
"version": "1.0.2",
"resolved": "http://trantor:8082/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
}
}
}

View File

@ -1,8 +0,0 @@
let opts = {
dirname: __dirname + '/src',
// http://stackoverflow.com/questions/2078915/a-regular-expression-to-exclude-a-word-string
filter: /^(?!index)([^\.].*)\.js?$/,
recursive: false,
merge: true // remove or comment to have each file in /lib be a prop/key in library...see node-require-all
}
module.exports = require('@uci/require-all')(opts)

15
log.log Normal file
View File

@ -0,0 +1,15 @@
{"name":"uci-base-app","hostname":"trantor","pid":9197,"level":30,"msg":"listening","time":"2018-01-16T03:04:08.127Z","v":0}
{"name":"uci-base-app","hostname":"trantor","pid":9497,"level":30,"msg":"listening","time":"2018-01-16T03:04:52.793Z","v":0}
{"name":"uci-base-app","hostname":"trantor","pid":9782,"level":30,"packet":{"sender":"test consumer","cmd":"test","data":"some data"},"msg":"attempting to send packet to socket","time":"2018-01-16T03:06:19.485Z","v":0}
{"name":"uci-base-app","hostname":"trantor","pid":11066,"level":30,"msg":"listening","time":"2018-01-16T03:19:19.403Z","v":0}
{"name":"uci-base-app","hostname":"trantor","pid":11392,"level":30,"msg":"listening","time":"2018-01-16T03:20:21.646Z","v":0}
{"name":"uci-base-server","hostname":"trantor","pid":12527,"level":30,"socket":"/opt/sockets/samplecs.sock","msg":"socket created","time":"2018-01-16T03:29:27.556Z","v":0}
{"name":"uci-base-app","hostname":"trantor","pid":12517,"level":30,"msg":"listening","time":"2018-01-16T03:29:27.938Z","v":0}
{"name":"uci-base-server","hostname":"trantor","pid":12527,"level":30,"msg":"\nhe's dead jim","time":"2018-01-16T03:29:39.682Z","v":0}
{"name":"uci-base-server","hostname":"trantor","pid":12698,"level":30,"socket":"/opt/sockets/samplecs.sock","msg":"socket created","time":"2018-01-16T03:30:39.131Z","v":0}
{"name":"uci-base-server","hostname":"trantor","pid":12698,"level":30,"msg":"\nhe's dead jim","time":"2018-01-16T03:33:07.420Z","v":0}
{"name":"uci-base-server","hostname":"trantor","pid":13006,"level":30,"socket":"/opt/sockets/samplecs.sock","msg":"socket created","time":"2018-01-16T03:33:10.467Z","v":0}
{"name":"uci-base-app","hostname":"trantor","pid":12996,"level":30,"msg":"listening","time":"2018-01-16T03:33:10.839Z","v":0}
{"name":"uci-base-server","hostname":"trantor","pid":13006,"level":30,"msg":"\nhe's dead jim","time":"2018-01-16T03:36:53.278Z","v":0}
{"name":"uci-base-server","hostname":"trantor","pid":13393,"level":30,"socket":"/opt/sockets/samplecs.sock","msg":"socket created","time":"2018-01-16T03:36:55.038Z","v":0}
{"name":"uci-base-server","hostname":"trantor","pid":13393,"level":30,"msg":"\nhe's dead jim","time":"2018-01-16T03:36:55.410Z","v":0}

34
logfile.log Normal file
View File

@ -0,0 +1,34 @@
2018-01-09 17:54:43.869 INFO data packet received to socket
[object Object]
2018-01-09 17:55:22.848 INFO data packet received to socket
[object Object]
2018-01-09 18:41:52.123 INFO data packet received to socket
[object Object]
2018-01-09 18:42:38.934 INFO data packet received to socket
[object Object]
2018-01-09 18:42:57.304 INFO data packet received to socket
[object Object]
2018-01-09 18:44:28.169 INFO data packet received to socket
[object Object]
2018-01-09 19:07:47.858 INFO data packet received to socket
[object Object]
2018-01-10 07:59:53.339 INFO data packet received to socket
[object Object]
2018-01-10 08:02:14.987 INFO data packet received to socket
[object Object]
2018-01-10 08:08:42.623 INFO data packet received to socket
[object Object]
2018-01-10 08:09:11.630 INFO data packet received to socket
[object Object]
2018-01-10 08:46:34.958 INFO data packet received to socket
[object Object]
2018-01-10 08:47:00.072 INFO data packet received to socket
[object Object]
2018-01-10 08:47:19.323 INFO data packet received to socket
[object Object]
2018-01-10 08:50:28.428 INFO data packet received to socket
[object Object]
2018-01-10 08:54:18.476 INFO data packet received to socket
[object Object]
2018-01-10 08:56:12.612 INFO data packet received to socket
[object Object]

1690
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,12 @@
{ {
"name": "@uci/device", "name": "@uci/base",
"version": "0.1.0", "version": "0.1.0",
"description": "Mutli Level/Transport Message/Event Classes", "description": "Mutli Level/Transport Message/Event Classes",
"main": "index.js", "main": "src/base.js",
"scripts": { "scripts": {
"testw": "node -r @std/esm ./node_modules/.bin/_mocha ./test --compilers=mjs:@std/esm --reporter list --recursive --watch", "testw": "mocha -r @std/esm test/*.test.mjs --watch --recurse --watch-extensions mjs",
"test": "istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -R spec --recursive && codecov || true" "test": "mocha -r @std/esm test/*.test.mjs",
"testci": "istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -R spec --recursive && codecov || true"
}, },
"author": "David Kebler", "author": "David Kebler",
"license": "MIT", "license": "MIT",
@ -23,18 +24,21 @@
"url": "https://github.com/uCOMmandIt/message/issues" "url": "https://github.com/uCOMmandIt/message/issues"
}, },
"homepage": "https://github.com/uCOMmandIt/message#readme", "homepage": "https://github.com/uCOMmandIt/message#readme",
"dependencies": {
"@uci/require-all": "^2.x",
"aggregation": "^1.2.1",
"node-ipc": "^9.1.1"
},
"@std/esm": "cjs", "@std/esm": "cjs",
"devDependencies": { "devDependencies": {
"@std/esm": "^0.18.0", "@std/esm": "^0.18.0",
"babel-eslint": "^8.2.1",
"chai": "^4.1.2", "chai": "^4.1.2",
"chai-as-promised": "^7.1.1", "chai-as-promised": "^7.1.1",
"codecov": "^3.0.0", "codecov": "^3.0.0",
"eslint": "^3.19.0",
"istanbul": "^0.4.5", "istanbul": "^0.4.5",
"mocha": "^4.0.1" "mocha": "^4.0.1"
},
"dependencies": {
"@uci/socket": "^0.1.0",
"@uci/utils": "^0.1.0",
"auto-bind": "^1.1.0",
"delimiter-stream": "^1.0.1"
} }
} }

View File

@ -1,4 +1,4 @@
# uCOMmandIt Message and Event Classes # uCOMmandIt Base Class for all Classes
<!-- find and replace the package name to match --> <!-- find and replace the package name to match -->
[![Build Status](https://img.shields.io/travis/uCOMmandIt/uci-pkg-template.svg?branch=master)](https://travis-ci.org/uCOMmandIt/uci-pkg-template) [![Build Status](https://img.shields.io/travis/uCOMmandIt/uci-pkg-template.svg?branch=master)](https://travis-ci.org/uCOMmandIt/uci-pkg-template)
@ -7,4 +7,4 @@
[![devDependencies](https://img.shields.io/david/dev/uCOMmandIt/uci-pkg-template.svg)](https://david-dm.org/uCOMmandIt/uci-pkg-template?type=dev) [![devDependencies](https://img.shields.io/david/dev/uCOMmandIt/uci-pkg-template.svg)](https://david-dm.org/uCOMmandIt/uci-pkg-template?type=dev)
[![codecov](https://img.shields.io/codecov/c/github/uCOMmandIt/uci-pkg-template/master.svg)](https://codecov.io/gh/uCOMmandIt/uci-pkg-template) [![codecov](https://img.shields.io/codecov/c/github/uCOMmandIt/uci-pkg-template/master.svg)](https://codecov.io/gh/uCOMmandIt/uci-pkg-template)
Multi-level Protocol Messaging/Event base class for all UCI devices hardware and software including buses and user frontend, backend, etc. Base Class extended for all UCI Classes

248
socket.log Normal file
View File

@ -0,0 +1,248 @@
{"name":"example:ts","hostname":"trantor","pid":21731,"level":30,"socket":{"host":"127.0.0.1","port":8080},"msg":"socket created","time":"2018-01-19T03:44:08.666Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":21731,"level":30,"msg":"listening","time":"2018-01-19T03:44:08.667Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":21731,"level":30,"msg":"server: new consumer connecting","time":"2018-01-19T03:44:08.669Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":21731,"level":30,"msg":"Server: sending handshake to consumer","time":"2018-01-19T03:44:08.669Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":21731,"level":30,"msg":"connecting","time":"2018-01-19T03:44:08.670Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":21731,"level":30,"msg":"waiting for 30ms for handshake","time":"2018-01-19T03:44:08.670Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":21731,"level":30,"msg":"handshake done, connected","time":"2018-01-19T03:44:08.701Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":21731,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"attempting to send packet to socket","time":"2018-01-19T03:44:08.702Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":21731,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"Server: packet received to socket","time":"2018-01-19T03:44:08.702Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":21731,"level":30,"msg":"\nhe's dead jim","time":"2018-01-19T03:45:03.804Z","v":0}
{"name":"example:us","hostname":"trantor","pid":21986,"level":30,"socket":{"path":"/home/david/AllData/hacking/active-dev-repos/uci/uci-base/examples/sample.sock"},"msg":"socket created","time":"2018-01-19T03:45:04.813Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":21986,"level":30,"msg":"listening","time":"2018-01-19T03:45:04.815Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":21986,"level":30,"socket":{"host":"127.0.0.1","port":8080},"msg":"socket created","time":"2018-01-19T03:45:04.814Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":21986,"level":30,"msg":"listening","time":"2018-01-19T03:45:04.815Z","v":0}
{"name":"example:us","hostname":"trantor","pid":21986,"level":30,"msg":"server: new consumer connecting","time":"2018-01-19T03:45:04.817Z","v":0}
{"name":"example:us","hostname":"trantor","pid":21986,"level":30,"msg":"Server: sending handshake to consumer","time":"2018-01-19T03:45:04.817Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":21986,"level":30,"path":"/home/david/AllData/hacking/active-dev-repos/uci/uci-base/examples/sample.sock","msg":"connecting","time":"2018-01-19T03:45:04.818Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":21986,"level":30,"msg":"waiting for 30ms for handshake","time":"2018-01-19T03:45:04.818Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":21986,"level":30,"msg":"server: new consumer connecting","time":"2018-01-19T03:45:04.817Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":21986,"level":30,"msg":"Server: sending handshake to consumer","time":"2018-01-19T03:45:04.817Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":21986,"level":30,"msg":"connecting","time":"2018-01-19T03:45:04.818Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":21986,"level":30,"msg":"waiting for 30ms for handshake","time":"2018-01-19T03:45:04.818Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":21986,"level":30,"msg":"handshake done, connected","time":"2018-01-19T03:45:04.850Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":21986,"level":30,"msg":"handshake done, connected","time":"2018-01-19T03:45:04.850Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":21986,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"attempting to send packet to socket","time":"2018-01-19T03:45:04.851Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":21986,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"attempting to send packet to socket","time":"2018-01-19T03:45:04.851Z","v":0}
{"name":"example:us","hostname":"trantor","pid":21986,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"Server: packet received to socket","time":"2018-01-19T03:45:04.851Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":21986,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"Server: packet received to socket","time":"2018-01-19T03:45:04.852Z","v":0}
{"name":"example:us","hostname":"trantor","pid":21986,"level":30,"msg":"\nhe's dead jim","time":"2018-01-19T03:48:28.606Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":21986,"level":30,"msg":"\nhe's dead jim","time":"2018-01-19T03:48:28.606Z","v":0}
{"name":"example:us","hostname":"trantor","pid":22228,"level":30,"socket":{"path":"/home/david/AllData/hacking/active-dev-repos/uci/uci-base/examples/sample.sock"},"msg":"socket created","time":"2018-01-19T03:48:30.313Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":22228,"level":30,"msg":"listening","time":"2018-01-19T03:48:30.314Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":22228,"level":30,"socket":{"host":"127.0.0.1","port":8080},"msg":"socket created","time":"2018-01-19T03:48:30.314Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":22228,"level":30,"msg":"listening","time":"2018-01-19T03:48:30.315Z","v":0}
{"name":"example:us","hostname":"trantor","pid":22228,"level":30,"msg":"server: new consumer connecting","time":"2018-01-19T03:48:30.316Z","v":0}
{"name":"example:us","hostname":"trantor","pid":22228,"level":30,"msg":"Server: sending handshake to consumer","time":"2018-01-19T03:48:30.316Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":22228,"level":30,"path":"/home/david/AllData/hacking/active-dev-repos/uci/uci-base/examples/sample.sock","msg":"connecting","time":"2018-01-19T03:48:30.317Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":22228,"level":30,"msg":"waiting for 30ms for handshake","time":"2018-01-19T03:48:30.317Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":22228,"level":30,"msg":"server: new consumer connecting","time":"2018-01-19T03:48:30.317Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":22228,"level":30,"msg":"Server: sending handshake to consumer","time":"2018-01-19T03:48:30.317Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":22228,"level":30,"msg":"connecting","time":"2018-01-19T03:48:30.318Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":22228,"level":30,"msg":"waiting for 30ms for handshake","time":"2018-01-19T03:48:30.318Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":22228,"level":30,"msg":"handshake done, connected","time":"2018-01-19T03:48:30.348Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":22228,"level":30,"msg":"handshake done, connected","time":"2018-01-19T03:48:30.348Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":22228,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"attempting to send packet to socket","time":"2018-01-19T03:48:30.348Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":22228,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"attempting to send packet to socket","time":"2018-01-19T03:48:30.349Z","v":0}
{"name":"example:us","hostname":"trantor","pid":22228,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"Server: packet received to socket","time":"2018-01-19T03:48:30.349Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":22228,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"Server: packet received to socket","time":"2018-01-19T03:48:30.350Z","v":0}
{"name":"example:us","hostname":"trantor","pid":22228,"level":30,"msg":"\nhe's dead jim","time":"2018-01-19T03:50:52.235Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":22228,"level":30,"msg":"\nhe's dead jim","time":"2018-01-19T03:50:52.236Z","v":0}
{"name":"example:us","hostname":"trantor","pid":22510,"level":30,"socket":{"path":"/home/david/AllData/hacking/active-dev-repos/uci/uci-base/examples/sample.sock"},"msg":"socket created","time":"2018-01-19T03:50:53.332Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":22510,"level":30,"msg":"listening","time":"2018-01-19T03:50:53.333Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":22510,"level":30,"socket":{"host":"127.0.0.1","port":8080},"msg":"socket created","time":"2018-01-19T03:50:53.333Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":22510,"level":30,"msg":"listening","time":"2018-01-19T03:50:53.334Z","v":0}
{"name":"example:us","hostname":"trantor","pid":22510,"level":30,"msg":"server: new consumer connecting","time":"2018-01-19T03:50:53.336Z","v":0}
{"name":"example:us","hostname":"trantor","pid":22510,"level":30,"msg":"Server: sending handshake to consumer","time":"2018-01-19T03:50:53.336Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":22510,"level":30,"path":"/home/david/AllData/hacking/active-dev-repos/uci/uci-base/examples/sample.sock","msg":"connecting","time":"2018-01-19T03:50:53.337Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":22510,"level":30,"msg":"waiting for 30ms for handshake","time":"2018-01-19T03:50:53.337Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":22510,"level":30,"msg":"server: new consumer connecting","time":"2018-01-19T03:50:53.337Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":22510,"level":30,"msg":"Server: sending handshake to consumer","time":"2018-01-19T03:50:53.337Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":22510,"level":30,"msg":"connecting","time":"2018-01-19T03:50:53.338Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":22510,"level":30,"msg":"waiting for 30ms for handshake","time":"2018-01-19T03:50:53.338Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":22510,"level":30,"msg":"handshake done, connected","time":"2018-01-19T03:50:53.368Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":22510,"level":30,"msg":"handshake done, connected","time":"2018-01-19T03:50:53.368Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":22510,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"attempting to send packet to socket","time":"2018-01-19T03:50:53.369Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":22510,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"attempting to send packet to socket","time":"2018-01-19T03:50:53.369Z","v":0}
{"name":"example:us","hostname":"trantor","pid":22510,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"Server: packet received to socket","time":"2018-01-19T03:50:53.369Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":22510,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"Server: packet received to socket","time":"2018-01-19T03:50:53.370Z","v":0}
{"name":"example:us","hostname":"trantor","pid":22510,"level":30,"msg":"\nhe's dead jim","time":"2018-01-19T04:22:11.024Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":22510,"level":30,"msg":"\nhe's dead jim","time":"2018-01-19T04:22:11.024Z","v":0}
{"name":"example:us","hostname":"trantor","pid":24716,"level":30,"socket":{"path":"/home/david/AllData/hacking/active-dev-repos/uci/uci-base/examples/sample.sock"},"msg":"socket created","time":"2018-01-19T04:22:13.170Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":24716,"level":30,"msg":"listening","time":"2018-01-19T04:22:13.172Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":24716,"level":30,"socket":{"host":"127.0.0.1","port":8080},"msg":"socket created","time":"2018-01-19T04:22:13.171Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":24716,"level":30,"msg":"listening","time":"2018-01-19T04:22:13.173Z","v":0}
{"name":"example:us","hostname":"trantor","pid":24716,"level":30,"msg":"server: new consumer connecting","time":"2018-01-19T04:22:13.174Z","v":0}
{"name":"example:us","hostname":"trantor","pid":24716,"level":30,"msg":"Server: sending handshake to consumer","time":"2018-01-19T04:22:13.174Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":24716,"level":30,"path":"/home/david/AllData/hacking/active-dev-repos/uci/uci-base/examples/sample.sock","msg":"connecting","time":"2018-01-19T04:22:13.175Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":24716,"level":30,"msg":"waiting for 30ms for handshake","time":"2018-01-19T04:22:13.175Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":24716,"level":30,"msg":"server: new consumer connecting","time":"2018-01-19T04:22:13.175Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":24716,"level":30,"msg":"Server: sending handshake to consumer","time":"2018-01-19T04:22:13.175Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":24716,"level":30,"msg":"connecting","time":"2018-01-19T04:22:13.176Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":24716,"level":30,"msg":"waiting for 30ms for handshake","time":"2018-01-19T04:22:13.176Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":24716,"level":30,"msg":"handshake done, connected","time":"2018-01-19T04:22:13.206Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":24716,"level":30,"msg":"handshake done, connected","time":"2018-01-19T04:22:13.206Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":24716,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"attempting to send packet to socket","time":"2018-01-19T04:22:13.207Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":24716,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"attempting to send packet to socket","time":"2018-01-19T04:22:13.207Z","v":0}
{"name":"example:us","hostname":"trantor","pid":24716,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"Server: packet received to socket","time":"2018-01-19T04:22:13.207Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":24716,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"Server: packet received to socket","time":"2018-01-19T04:22:13.208Z","v":0}
{"name":"example:us","hostname":"trantor","pid":24716,"level":30,"msg":"\nhe's dead jim","time":"2018-01-19T04:22:47.356Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":24716,"level":30,"msg":"\nhe's dead jim","time":"2018-01-19T04:22:47.357Z","v":0}
{"name":"example:us","hostname":"trantor","pid":24818,"level":30,"socket":{"path":"/home/david/AllData/hacking/active-dev-repos/uci/uci-base/examples/sample.sock"},"msg":"socket created","time":"2018-01-19T04:22:48.444Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":24818,"level":30,"msg":"listening","time":"2018-01-19T04:22:48.445Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":24818,"level":30,"msg":"listening","time":"2018-01-19T04:22:48.446Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":24818,"level":30,"socket":{"host":"127.0.0.1","port":8080},"msg":"socket created","time":"2018-01-19T04:22:48.445Z","v":0}
{"name":"example:us","hostname":"trantor","pid":24818,"level":30,"msg":"server: new consumer connecting","time":"2018-01-19T04:22:48.447Z","v":0}
{"name":"example:us","hostname":"trantor","pid":24818,"level":30,"msg":"Server: sending handshake to consumer","time":"2018-01-19T04:22:48.447Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":24818,"level":30,"path":"/home/david/AllData/hacking/active-dev-repos/uci/uci-base/examples/sample.sock","msg":"connecting","time":"2018-01-19T04:22:48.448Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":24818,"level":30,"msg":"waiting for 30ms for handshake","time":"2018-01-19T04:22:48.449Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":24818,"level":30,"msg":"connecting","time":"2018-01-19T04:22:48.449Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":24818,"level":30,"msg":"waiting for 30ms for handshake","time":"2018-01-19T04:22:48.449Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":24818,"level":30,"msg":"server: new consumer connecting","time":"2018-01-19T04:22:48.448Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":24818,"level":30,"msg":"Server: sending handshake to consumer","time":"2018-01-19T04:22:48.448Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":24818,"level":30,"msg":"handshake done, connected","time":"2018-01-19T04:22:48.479Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":24818,"level":30,"msg":"handshake done, connected","time":"2018-01-19T04:22:48.479Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":24818,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"attempting to send packet to socket","time":"2018-01-19T04:22:48.480Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":24818,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"attempting to send packet to socket","time":"2018-01-19T04:22:48.480Z","v":0}
{"name":"example:us","hostname":"trantor","pid":24818,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"Server: packet received to socket","time":"2018-01-19T04:22:48.481Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":24818,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"Server: packet received to socket","time":"2018-01-19T04:22:48.481Z","v":0}
{"name":"example:us","hostname":"trantor","pid":24818,"level":30,"msg":"\nhe's dead jim","time":"2018-01-19T04:24:12.269Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":24818,"level":30,"msg":"\nhe's dead jim","time":"2018-01-19T04:24:12.269Z","v":0}
{"name":"example:us","hostname":"trantor","pid":25001,"level":30,"socket":{"path":"/home/david/AllData/hacking/active-dev-repos/uci/uci-base/examples/sample.sock"},"msg":"socket created","time":"2018-01-19T04:24:15.282Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":25001,"level":30,"msg":"listening","time":"2018-01-19T04:24:15.283Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":25001,"level":30,"socket":{"host":"127.0.0.1","port":8080},"msg":"socket created","time":"2018-01-19T04:24:15.283Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":25001,"level":30,"msg":"listening","time":"2018-01-19T04:24:15.284Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":25001,"level":30,"path":"/home/david/AllData/hacking/active-dev-repos/uci/uci-base/examples/sample.sock","msg":"connecting","time":"2018-01-19T04:24:15.286Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":25001,"level":30,"msg":"waiting for 30ms for handshake","time":"2018-01-19T04:24:15.287Z","v":0}
{"name":"example:us","hostname":"trantor","pid":25001,"level":30,"msg":"server: new consumer connecting","time":"2018-01-19T04:24:15.285Z","v":0}
{"name":"example:us","hostname":"trantor","pid":25001,"level":30,"msg":"Server: sending handshake to consumer","time":"2018-01-19T04:24:15.285Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":25001,"level":30,"msg":"server: new consumer connecting","time":"2018-01-19T04:24:15.286Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":25001,"level":30,"msg":"Server: sending handshake to consumer","time":"2018-01-19T04:24:15.286Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":25001,"level":30,"msg":"connecting","time":"2018-01-19T04:24:15.287Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":25001,"level":30,"msg":"waiting for 30ms for handshake","time":"2018-01-19T04:24:15.287Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":25001,"level":30,"msg":"handshake done, connected","time":"2018-01-19T04:24:15.317Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":25001,"level":30,"msg":"handshake done, connected","time":"2018-01-19T04:24:15.317Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":25001,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"attempting to send packet to socket","time":"2018-01-19T04:24:15.318Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":25001,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"attempting to send packet to socket","time":"2018-01-19T04:24:15.318Z","v":0}
{"name":"example:us","hostname":"trantor","pid":25001,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"Server: packet received to socket","time":"2018-01-19T04:24:15.319Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":25001,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"Server: packet received to socket","time":"2018-01-19T04:24:15.319Z","v":0}
{"name":"example:us","hostname":"trantor","pid":25001,"level":30,"msg":"\nhe's dead jim","time":"2018-01-19T04:25:37.308Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":25001,"level":30,"msg":"\nhe's dead jim","time":"2018-01-19T04:25:37.309Z","v":0}
{"name":"example:us","hostname":"trantor","pid":25165,"level":30,"socket":{"path":"/home/david/AllData/hacking/active-dev-repos/uci/uci-base/examples/sample.sock"},"msg":"socket created","time":"2018-01-19T04:25:39.013Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":25165,"level":30,"socket":{"host":"127.0.0.1","port":8080},"msg":"socket created","time":"2018-01-19T04:25:39.014Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":25165,"level":30,"msg":"listening","time":"2018-01-19T04:25:39.015Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":25165,"level":30,"msg":"listening","time":"2018-01-19T04:25:39.014Z","v":0}
{"name":"example:us","hostname":"trantor","pid":25165,"level":30,"msg":"server: new consumer connecting","time":"2018-01-19T04:25:39.016Z","v":0}
{"name":"example:us","hostname":"trantor","pid":25165,"level":30,"msg":"Server: sending handshake to consumer","time":"2018-01-19T04:25:39.016Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":25165,"level":30,"msg":"server: new consumer connecting","time":"2018-01-19T04:25:39.017Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":25165,"level":30,"msg":"Server: sending handshake to consumer","time":"2018-01-19T04:25:39.017Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":25165,"level":30,"msg":"connecting","time":"2018-01-19T04:25:39.018Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":25165,"level":30,"msg":"waiting for 30ms for handshake","time":"2018-01-19T04:25:39.018Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":25165,"level":30,"path":"/home/david/AllData/hacking/active-dev-repos/uci/uci-base/examples/sample.sock","msg":"connecting","time":"2018-01-19T04:25:39.017Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":25165,"level":30,"msg":"waiting for 30ms for handshake","time":"2018-01-19T04:25:39.017Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":25165,"level":30,"msg":"handshake done, connected","time":"2018-01-19T04:25:39.048Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":25165,"level":30,"msg":"handshake done, connected","time":"2018-01-19T04:25:39.048Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":25165,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"attempting to send packet to socket","time":"2018-01-19T04:25:39.048Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":25165,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"attempting to send packet to socket","time":"2018-01-19T04:25:39.048Z","v":0}
{"name":"example:us","hostname":"trantor","pid":25165,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"Server: packet received to socket","time":"2018-01-19T04:25:39.049Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":25165,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"Server: packet received to socket","time":"2018-01-19T04:25:39.049Z","v":0}
{"name":"example:us","hostname":"trantor","pid":25165,"level":30,"msg":"\nhe's dead jim","time":"2018-01-19T04:26:35.417Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":25165,"level":30,"msg":"\nhe's dead jim","time":"2018-01-19T04:26:35.417Z","v":0}
{"name":"example:us","hostname":"trantor","pid":25356,"level":30,"socket":{"path":"/home/david/AllData/hacking/active-dev-repos/uci/uci-base/examples/sample.sock"},"msg":"socket created","time":"2018-01-19T04:26:36.891Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":25356,"level":30,"msg":"listening","time":"2018-01-19T04:26:36.893Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":25356,"level":30,"socket":{"host":"127.0.0.1","port":8080},"msg":"socket created","time":"2018-01-19T04:26:36.892Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":25356,"level":30,"msg":"listening","time":"2018-01-19T04:26:36.894Z","v":0}
{"name":"example:us","hostname":"trantor","pid":25356,"level":30,"msg":"server: new consumer connecting","time":"2018-01-19T04:26:36.896Z","v":0}
{"name":"example:us","hostname":"trantor","pid":25356,"level":30,"msg":"Server: sending handshake to consumer","time":"2018-01-19T04:26:36.896Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":25356,"level":30,"path":"/home/david/AllData/hacking/active-dev-repos/uci/uci-base/examples/sample.sock","msg":"connecting","time":"2018-01-19T04:26:36.897Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":25356,"level":30,"msg":"waiting for 30ms for handshake","time":"2018-01-19T04:26:36.897Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":25356,"level":30,"msg":"server: new consumer connecting","time":"2018-01-19T04:26:36.897Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":25356,"level":30,"msg":"Server: sending handshake to consumer","time":"2018-01-19T04:26:36.897Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":25356,"level":30,"msg":"connecting","time":"2018-01-19T04:26:36.898Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":25356,"level":30,"msg":"waiting for 30ms for handshake","time":"2018-01-19T04:26:36.898Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":25356,"level":30,"msg":"handshake done, connected","time":"2018-01-19T04:26:36.928Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":25356,"level":30,"msg":"handshake done, connected","time":"2018-01-19T04:26:36.928Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":25356,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"attempting to send packet to socket","time":"2018-01-19T04:26:36.928Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":25356,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"attempting to send packet to socket","time":"2018-01-19T04:26:36.929Z","v":0}
{"name":"example:us","hostname":"trantor","pid":25356,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"Server: packet received to socket","time":"2018-01-19T04:26:36.929Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":25356,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"Server: packet received to socket","time":"2018-01-19T04:26:36.929Z","v":0}
{"name":"example:us","hostname":"trantor","pid":25356,"level":30,"msg":"\nhe's dead jim","time":"2018-01-19T04:29:04.611Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":25356,"level":30,"msg":"\nhe's dead jim","time":"2018-01-19T04:29:04.611Z","v":0}
{"name":"example:us","hostname":"trantor","pid":25541,"level":30,"socket":{"path":"/home/david/AllData/hacking/active-dev-repos/uci/uci-base/examples/sample.sock"},"msg":"socket created","time":"2018-01-19T04:29:06.035Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":25541,"level":30,"msg":"listening","time":"2018-01-19T04:29:06.037Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":25541,"level":30,"socket":{"host":"127.0.0.1","port":8080},"msg":"socket created","time":"2018-01-19T04:29:06.036Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":25541,"level":30,"msg":"listening","time":"2018-01-19T04:29:06.037Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":25541,"level":30,"path":"/home/david/AllData/hacking/active-dev-repos/uci/uci-base/examples/sample.sock","msg":"connecting","time":"2018-01-19T04:29:06.039Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":25541,"level":30,"msg":"waiting for 30ms for handshake","time":"2018-01-19T04:29:06.040Z","v":0}
{"name":"example:us","hostname":"trantor","pid":25541,"level":30,"msg":"server: new consumer connecting","time":"2018-01-19T04:29:06.038Z","v":0}
{"name":"example:us","hostname":"trantor","pid":25541,"level":30,"msg":"Server: sending handshake to consumer","time":"2018-01-19T04:29:06.038Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":25541,"level":30,"msg":"server: new consumer connecting","time":"2018-01-19T04:29:06.039Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":25541,"level":30,"msg":"Server: sending handshake to consumer","time":"2018-01-19T04:29:06.039Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":25541,"level":30,"msg":"connecting","time":"2018-01-19T04:29:06.040Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":25541,"level":30,"msg":"waiting for 30ms for handshake","time":"2018-01-19T04:29:06.040Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":25541,"level":30,"msg":"handshake done, connected","time":"2018-01-19T04:29:06.070Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":25541,"level":30,"msg":"handshake done, connected","time":"2018-01-19T04:29:06.070Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":25541,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"attempting to send packet to socket","time":"2018-01-19T04:29:06.071Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":25541,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"attempting to send packet to socket","time":"2018-01-19T04:29:06.071Z","v":0}
{"name":"example:us","hostname":"trantor","pid":25541,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"Server: packet received to socket","time":"2018-01-19T04:29:06.071Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":25541,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"Server: packet received to socket","time":"2018-01-19T04:29:06.072Z","v":0}
{"name":"example:us","hostname":"trantor","pid":25541,"level":30,"msg":"\nhe's dead jim","time":"2018-01-19T04:36:21.048Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":25541,"level":30,"msg":"\nhe's dead jim","time":"2018-01-19T04:36:21.048Z","v":0}
{"name":"example:us","hostname":"trantor","pid":26135,"level":30,"socket":{"path":"/home/david/AllData/hacking/active-dev-repos/uci/uci-base/examples/sample.sock"},"msg":"socket created","time":"2018-01-19T04:36:22.965Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":26135,"level":30,"msg":"listening","time":"2018-01-19T04:36:22.967Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":26135,"level":30,"socket":{"host":"127.0.0.1","port":8080},"msg":"socket created","time":"2018-01-19T04:36:22.966Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":26135,"level":30,"msg":"listening","time":"2018-01-19T04:36:22.967Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":26135,"level":30,"path":"/home/david/AllData/hacking/active-dev-repos/uci/uci-base/examples/sample.sock","msg":"connecting","time":"2018-01-19T04:36:22.970Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":26135,"level":30,"msg":"waiting for 30ms for handshake","time":"2018-01-19T04:36:22.970Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":26135,"level":30,"msg":"server: new consumer connecting","time":"2018-01-19T04:36:22.969Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":26135,"level":30,"msg":"Server: sending handshake to consumer","time":"2018-01-19T04:36:22.969Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":26135,"level":30,"msg":"connecting","time":"2018-01-19T04:36:22.970Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":26135,"level":30,"msg":"waiting for 30ms for handshake","time":"2018-01-19T04:36:22.971Z","v":0}
{"name":"example:us","hostname":"trantor","pid":26135,"level":30,"msg":"server: new consumer connecting","time":"2018-01-19T04:36:22.969Z","v":0}
{"name":"example:us","hostname":"trantor","pid":26135,"level":30,"msg":"Server: sending handshake to consumer","time":"2018-01-19T04:36:22.969Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":26135,"level":30,"msg":"handshake done, connected","time":"2018-01-19T04:36:23.001Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":26135,"level":30,"msg":"handshake done, connected","time":"2018-01-19T04:36:23.001Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":26135,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"attempting to send packet to socket","time":"2018-01-19T04:36:23.001Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":26135,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"attempting to send packet to socket","time":"2018-01-19T04:36:23.002Z","v":0}
{"name":"example:us","hostname":"trantor","pid":26135,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"Server: packet received to socket","time":"2018-01-19T04:36:23.002Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":26135,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"Server: packet received to socket","time":"2018-01-19T04:36:23.003Z","v":0}
{"name":"example:us","hostname":"trantor","pid":26135,"level":30,"msg":"\nhe's dead jim","time":"2018-01-19T04:36:44.458Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":26135,"level":30,"msg":"\nhe's dead jim","time":"2018-01-19T04:36:44.458Z","v":0}
{"name":"example:us","hostname":"trantor","pid":26222,"level":30,"socket":{"path":"/home/david/AllData/hacking/active-dev-repos/uci/uci-base/examples/sample.sock"},"msg":"socket created","time":"2018-01-19T04:36:45.284Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":26222,"level":30,"msg":"listening","time":"2018-01-19T04:36:45.285Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":26222,"level":30,"socket":{"host":"127.0.0.1","port":8080},"msg":"socket created","time":"2018-01-19T04:36:45.285Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":26222,"level":30,"msg":"listening","time":"2018-01-19T04:36:45.286Z","v":0}
{"name":"example:us","hostname":"trantor","pid":26222,"level":30,"msg":"server: new consumer connecting","time":"2018-01-19T04:36:45.288Z","v":0}
{"name":"example:us","hostname":"trantor","pid":26222,"level":30,"msg":"Server: sending handshake to consumer","time":"2018-01-19T04:36:45.288Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":26222,"level":30,"msg":"server: new consumer connecting","time":"2018-01-19T04:36:45.288Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":26222,"level":30,"msg":"Server: sending handshake to consumer","time":"2018-01-19T04:36:45.288Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":26222,"level":30,"msg":"connecting","time":"2018-01-19T04:36:45.290Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":26222,"level":30,"msg":"waiting for 30ms for handshake","time":"2018-01-19T04:36:45.290Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":26222,"level":30,"path":"/home/david/AllData/hacking/active-dev-repos/uci/uci-base/examples/sample.sock","msg":"connecting","time":"2018-01-19T04:36:45.289Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":26222,"level":30,"msg":"waiting for 30ms for handshake","time":"2018-01-19T04:36:45.289Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":26222,"level":30,"msg":"handshake done, connected","time":"2018-01-19T04:36:45.320Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":26222,"level":30,"msg":"handshake done, connected","time":"2018-01-19T04:36:45.320Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":26222,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"attempting to send packet to socket","time":"2018-01-19T04:36:45.320Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":26222,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"attempting to send packet to socket","time":"2018-01-19T04:36:45.320Z","v":0}
{"name":"example:us","hostname":"trantor","pid":26222,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"Server: packet received to socket","time":"2018-01-19T04:36:45.321Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":26222,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"Server: packet received to socket","time":"2018-01-19T04:36:45.321Z","v":0}
{"name":"example:us","hostname":"trantor","pid":26222,"level":30,"msg":"\nhe's dead jim","time":"2018-01-19T04:40:46.019Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":26222,"level":30,"msg":"\nhe's dead jim","time":"2018-01-19T04:40:46.020Z","v":0}
{"name":"example:us","hostname":"trantor","pid":26643,"level":30,"socket":{"path":"/home/david/AllData/hacking/active-dev-repos/uci/uci-base/examples/sample.sock"},"msg":"socket created","time":"2018-01-19T04:41:16.401Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":26643,"level":30,"msg":"listening","time":"2018-01-19T04:41:16.403Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":26643,"level":30,"socket":{"host":"127.0.0.1","port":8080},"msg":"socket created","time":"2018-01-19T04:41:16.402Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":26643,"level":30,"msg":"listening","time":"2018-01-19T04:41:16.403Z","v":0}
{"name":"example:us","hostname":"trantor","pid":26643,"level":30,"msg":"server: new consumer connecting","time":"2018-01-19T04:41:16.405Z","v":0}
{"name":"example:us","hostname":"trantor","pid":26643,"level":30,"msg":"Server: sending handshake to consumer","time":"2018-01-19T04:41:16.405Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":26643,"level":30,"path":"/home/david/AllData/hacking/active-dev-repos/uci/uci-base/examples/sample.sock","msg":"connecting","time":"2018-01-19T04:41:16.406Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":26643,"level":30,"msg":"waiting for 30ms for handshake","time":"2018-01-19T04:41:16.406Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":26643,"level":30,"msg":"server: new consumer connecting","time":"2018-01-19T04:41:16.405Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":26643,"level":30,"msg":"Server: sending handshake to consumer","time":"2018-01-19T04:41:16.405Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":26643,"level":30,"msg":"connecting","time":"2018-01-19T04:41:16.406Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":26643,"level":30,"msg":"waiting for 30ms for handshake","time":"2018-01-19T04:41:16.407Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":26643,"level":30,"msg":"handshake done, connected","time":"2018-01-19T04:41:16.437Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":26643,"level":30,"msg":"handshake done, connected","time":"2018-01-19T04:41:16.437Z","v":0}
{"name":"example:uc","hostname":"trantor","pid":26643,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"attempting to send packet to socket","time":"2018-01-19T04:41:16.437Z","v":0}
{"name":"example:tc","hostname":"trantor","pid":26643,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"attempting to send packet to socket","time":"2018-01-19T04:41:16.437Z","v":0}
{"name":"example:us","hostname":"trantor","pid":26643,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"Server: packet received to socket","time":"2018-01-19T04:41:16.438Z","v":0}
{"name":"example:ts","hostname":"trantor","pid":26643,"level":30,"packet":{"cmd":"echo","data":"some data to echo"},"msg":"Server: packet received to socket","time":"2018-01-19T04:41:16.438Z","v":0}

56
src/base.mjs Normal file
View File

@ -0,0 +1,56 @@
import { Socket, Consumer } from '../../uci-socket/src'
// import { Socket as TCPSocket, Consumer as TCPConsumer } from '@uci/tcp-socket'
import EventEmitter from 'events'
// import autoBind from 'auto-bind'
export default class Base extends EventEmitter {
constructor(opts={}) {
super()
this.id = opts.id // a unique ecosystem wide id, could be generated
this.desc = opts.desc // additional details for humans
// attach unix socket OR consumer(default) only if path is supplied
this.socket = []
this.consumer = []
this.com = opts.com.split(/[,:|\s]+/)
this.com.forEach( sock => {
opts.name = this.id +':'+sock
switch (sock) {
case
'us':
opts.spp = opts.uspp ? opts.uspp : opts.spp
this.socket.push(new Socket(opts.path,opts))
break
case 'uc':
this.consumer.push(new Consumer(opts.path,opts))
break
case 'ts':
opts.spp = opts.tspp ? opts.tspp : opts.spp
this.socket.push(new Socket(opts))
break
case 'tc':
this.consumer.push(new Consumer(opts))
}
})
// autoBind(this)
} // end constructor
// this override default echo processor needs command 'cmd' as a minimum. Will pass data and sender property
async processPacket(packet) {
if (!packet.cmd) return {error: 'no command in packet', packet: packet }
if (!this[packet.cmd]) return {error: 'no processing function supplied for command', packet: packet }
return await this[packet.cmd](packet)
}
async init () {
await Promise.all(this.socket.map( sock => sock.create(this)))
return Promise.all(this.consumer.map( con => con.connect(this)))
} // init
async send (packet) {
this.emit(packet.cmd, packet)
return await Promise.all(this.consumer.map(con => con.send(packet)))
}
} // end class

View File

@ -1,41 +0,0 @@
// Every UCI device whether it be hardware or strictly software device has in common
// A means of communication to other devices whether they be on the same machine host, across a network or even within itself
// To
import EventEmitter from 'events'
import IPC from 'node-ipc/services/IPC'
import aggregate from 'aggregation/es6'
console.log(IPC)
export default class Device extends aggregate(EventEmitter,IPC) {
constructor(id, opts) {
super()
this.id = id //must be unique in entire messaging system
if (opts) {
this.transports = opts.transports
}
}
async init() {}
async listen(message) {
console.log(message)
}
async send(message) {
console.log(message)
}
}
// # dc|intra|native|unix|tcp|mqtt
// # dc = direct call without messaging.
// # intra = within same process (standard node event emitter)
// # native = node child process using pipes
// # unix = unix socket on same host/machine
// # tcp = using
// # tls = secure TCP
// # udp
// # mqtt

View File

@ -1,76 +0,0 @@
'use strict'
// **********************************
class Device {
// bus is i2c-bus bus object
constructor(bus, address, opts) {
this.bus = bus
this.address = address
if (opts) {
this.id = opts.id // must be unique within a bus
this.desc = opts.desc
this.channel = opts.channel // if using TAC9546A channel number on which device is attached
}
}
async _setChannel() {
// console.log('before set',this.address,this.id,this.channel, this.bus.getState)
if (this.channel) {
if (!this.bus.address) { return Promise.reject('Channel set but no mux on bus')}
return this.bus.set(this.channel)
}
return Promise.resolve() // no channel for device either no mux or device is attached to mux bypass
}
// for devices that need just a simple send of a byte without a register command
async receive() {
await this._setChannel()
return this.bus.receive(this.address)
}
async send(cmd, byte) {
await this._setChannel()
return this.bus.send(this.address, cmd, byte)
}
// for devices needing a buffer/stream
async readRaw(length, buffer) {
await this._setChannel()
return this.bus.readRaw(this.address, length, buffer)
}
async writeRaw(length, buffer) {
await this._setChannel()
return this.bus.writeRaw(this.address, length, buffer)
}
// both cmd and byte should be a single byte as a decimal or hex
async read(cmd) {
await this._setChannel()
// console.log('after set before read',this.address,this.id,this.channel,this.bus.getState)
return this.bus.read(this.address, cmd)
}
async write(cmd, byte) {
await this._setChannel()
// console.log('after set, before write',this.address,this.id,this.channel,this.bus.getState)
return this.bus.write(this.address, cmd, byte)
}
// for I2C devices that use a word length packackage
async read2(cmd) {
await this._setChannel()
return this.bus.read2(this.address, cmd)
}
async write2(cmd, bytes) {
await this._setChannel()
return this.bus.write2(this.address, cmd, bytes)
}
}
module.exports = {
Device
}

View File

@ -1,29 +0,0 @@
import ipc from 'node-ipc'
// const ipc = require('node-ipc')
ipc.config.id = 'broker'
ipc.config.retry= 1500
ipc.serve(
function(){
ipc.server.on(
'device.req',
function(data,socket){
if (data.message === 'understand') {
ipc.server.emit(
socket,
'server.res',
{
id : ipc.config.id,
message : `Message from ${data.id} understood`
}
)
}
}
)
}
)
ipc.server.start()

View File

@ -1,41 +0,0 @@
import ipc from 'node-ipc'
const BROKER_ID = 'broker'
ipc.config.id = 'somedevice'
ipc.config.retry = 1000
ipc.connectTo(
BROKER_ID,
function(){
ipc.of[BROKER_ID].on(
'connect',
function(){
ipc.log(`connected to ${BROKER_ID}`)
ipc.of[BROKER_ID].emit(
'device.req',
{
id : ipc.config.id,
message : 'understand'
}
)
}
)
// ipc.of.bus.on(
// 'disconnect',
// function(){
// ipc.log('disconnected from bus')
// }
// )
// listen for bus
ipc.of[BROKER_ID].on(
'server.res',
function(data){
ipc.log('got a response from server : ', data)
}
)
// console.log(ipc.of.bus.destroy)
}
)

1
test/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/node_modules/

19
test/base.socket.mjs Normal file
View File

@ -0,0 +1,19 @@
import Base from '../src/base'
const USOCKET = '/opt/sockets/samplecs.sock'
let server = new Base({id:'uci-base-server', desc:'socket server', usocket: true, path:USOCKET})
server.test = async (packet) => {
packet.processed = true
return packet
}
;
(async () => {
// using default packet processor
await server.usocket.create()
})().catch(err => {
console.error('FATAL: UNABLE TO START SYSTEM!\n',err)
})

91
test/base.test.mjs Normal file
View File

@ -0,0 +1,91 @@
import { spawn } from 'child_process'
import chai from 'chai'
import chaiAsPromised from 'chai-as-promised'
import Base from '../src/base'
chai.use(chaiAsPromised)
const expect = chai.expect
const USOCKET = '/opt/sockets/samplecs.sock'
const delay = time => new Promise(res=>setTimeout(()=>res(),time))
let app = new Base({id:'uci-base-app', desc:'a consumer app', path:USOCKET})
// app.ucpp = 'cprocessPacket'
//
// app.processPacket = async function (packet) {
// console.log('packet received from socket')
// console.dir(packet)
// app.emit('test2', packet)
// }
describe('Base Class', function () {
it('Has an id', function () {
expect(app.id).to.equal('uci-base-app')
})
it('Has a description', function () {
expect(app.desc).to.equal('a consumer app')
})
it('Is basic emitter', function () {
app.on('etest',function(data){
expect(data).to.equal('test')
})
app.emit('etest', 'test')
})
})
;
(async () => {
let socket={}
socket = spawn('node',['-r', '@std/esm', './test/base.socket'])
await delay(500) // wait for socket to get going
await app.init()
//
// let packet = {sender:'test consumer', cmd:'test', data:'some data'}
// app.test = (packet) =>{
// console.dir('packet',packet)
// }
// app.send(packet)
// await delay(1000)
socket.kill()
})().catch(err => {
console.error('FATAL: UNABLE TO START SYSTEM!\n',err)
})
// describe('Base Class - sockets', function () {
//
// let socket={}
//
// before(async function(){
// socket = spawn('node',['-r', '@std/esm', './test/base.socket'])
// await delay(500) // wait for socket to get going
// // await app.init()
// })
//
// after(async function(){
// socket.kill()
// })
//
// it('Can communicate via unix socket', async function () {
// let packet = {sender:'test consumer', cmd:'test', data:'some data'}
// app.test = (packet) =>{
// console.dir('packet',packet)
// // expect(packet.processed).to.equal(true)
// expect(packet.data).to.equal('some data')
// }
// app.send(packet)
// await delay(1000)
// })
// })

View File

@ -1,35 +0,0 @@
import chai from 'chai'
import chaiAsPromised from 'chai-as-promised'
import Device from '../src/device'
chai.use(chaiAsPromised)
const expect = chai.expect
let device = new Device('test')
describe('Device Class - ', function () {
it('Has properties', function () {
expect(device.id).to.equal('test')
})
// function getAllMethodNames(obj) {
// let methods = new Set()
// while (obj = Reflect.getPrototypeOf(obj)) {
// let keys = Reflect.ownKeys(obj)
// keys.forEach((k) => methods.add(k))
// }
// return methods
// }
//
// let methods = getAllMethodNames(device)
// console.log([...methods])
// it('Can write and read to actual device', function () {
//
// device.write(0x09, SET).then(expect(device.read(0x0A)).to.eventually.equal(SET))
// .then(setTimeout(() => device.write(0x09, 0), 3000))
// .catch(err => console.log('an error', err))
// })
})

3
test/log.log Normal file
View File

@ -0,0 +1,3 @@
{"name":"uci-base-server","hostname":"trantor","pid":12374,"level":30,"socket":"/opt/sockets/samplecs.sock","msg":"already exists...deleting","time":"2018-01-16T03:28:36.376Z","v":0}
{"name":"uci-base-server","hostname":"trantor","pid":12374,"level":30,"socket":"/opt/sockets/samplecs.sock","msg":"socket created","time":"2018-01-16T03:28:36.378Z","v":0}
{"name":"uci-base-server","hostname":"trantor","pid":12374,"level":30,"msg":"\nhe's dead jim","time":"2018-01-16T03:28:39.265Z","v":0}