0.1.22 bump because of change in uci-socket

master
David Kebler 2019-05-01 15:37:52 -07:00
parent 903d907201
commit c1d35f7c0f
3 changed files with 11 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@uci/base",
"version": "0.1.21",
"version": "0.1.22",
"description": "Multi type and transport JSON packet communication base class. Used in UCI extended classes",
"main": "src/base",
"scripts": {
@ -39,7 +39,7 @@
"@uci-utils/bind-funcs": "^0.2.3",
"@uci-utils/logger": "^0.0.14",
"@uci/mqtt": "^0.1.11",
"@uci/socket": "^0.2.13",
"@uci/socket": "^0.2.14",
"@uci/websocket": "^0.3.7",
"await-to-js": "^2.1.1",
"p-settle": "^3.1.0"

View File

@ -232,6 +232,7 @@ class Base extends EventEmitter {
}
async push(packet) {
// TODO set like send to accept a name
let broadcast = []
for (let name of Object.keys(this._socket)) {
if (this._socket[name].type === 's') {
@ -248,6 +249,9 @@ class Base extends EventEmitter {
)
}
// TODO make push version of all this sends
// TODO accept alt transport string i.e. t or TCP
async sendTransport(packet, transport) {
let sends = []
for (let name of Object.keys(this._socket)) {
@ -269,10 +273,14 @@ class Base extends EventEmitter {
async sendTCP(packet) {
return this.sendTransport(packet, 't')
}
// TODO change this to PIPE
async sendIPC(packet) {
return this.sendTransport(packet, 'n')
}
// TODO add sendMQTT, sendWS
socketsListen(event,fn) {
this._eventListen('s',event,fn)

View File

@ -70,6 +70,7 @@ const defaultCmds ={
packet.info = 'default socket echo'
return packet
},
// add sedning along an ack to any consumers and or pushing to other sockets on this device
ack: async packet => {
packet.cmd = 'reply'
packet.ack = true