diff --git a/examples/dynamic.js b/examples/dynamic.js deleted file mode 100644 index 02a61da..0000000 --- a/examples/dynamic.js +++ /dev/null @@ -1,43 +0,0 @@ -import Base from '../src/base' - -// const USOCKET = __dirname + '/sample.sock' - -let dy = new Base({id:'dynamic'}) - -; -(async () => { - - - await dy.init() - console.log('started', dy.started) - await Promise.all([dy.addSocket('con','c','t'),dy.addSocket('ser','s','t')]) - - dy.good = { - bad: function(packet){ - return new Promise( async (resolve) => { - let res = {} - res.req = packet - res.cmd='good/ugly' - res.response='The Good The Bad and The Ugly' - return resolve(res) - }) - }, - ugly: function (packet) { - console.log('==============reply from Good Bad command =========') - console.log(packet.response) - console.log('===========================') - } - } - - let packet = {} - // console.log('=============sending============') - packet = {cmd:'good:bad'} - console.log(packet) - await dy.send(packet) - - process.kill(process.pid, 'SIGTERM') - -})().catch(err => { - console.error('FATAL: UNABLE TO START SYSTEM!\n',err) - process.kill(process.pid, 'SIGTERM') -}) diff --git a/examples/four-in-one.js b/examples/four-in-one.js index f75fabb..91666ac 100644 --- a/examples/four-in-one.js +++ b/examples/four-in-one.js @@ -1,38 +1,49 @@ import Base from '../src/base' - -// const USOCKET = __dirname + '/sample.sock' +import hahooks from './ha-mqtt' const socketfuncs = { switch: { - on: function(packet){ + status: function(packet){ return new Promise( async (resolve) => { packet.cmd='switch/status' - packet.status='on' + packet.state=this.switches[packet.id-1] packet.sender= packet.sender || (packet._header ? packet._header.sender.name : 'unknown') this.push(packet) // push to all active socket servers let res = { response:'status pushed on to all clients'} return resolve(res) // this goes back to sender }) }, + on: function(packet){ + return new Promise( async (resolve) => { + packet.cmd='switch/status' + packet.state='on' + this.switches[packet.id-1] = 'on' + packet.sender= packet.sender || (packet._header ? packet._header.sender.name : 'unknown') + this.push(packet) // push to all active socket servers + let res = { response:'status change - pushed on to all clients', id:packet.id} + return resolve(res) // this goes back to sender + }) + }, off: function(packet){ return new Promise( async (resolve) => { packet.cmd='switch/status' - packet.status='off' + packet.state='off' + this.switches[packet.id-1] = 'off' packet.sender= packet.sender || (packet._header ? packet._header.sender.name : 'unknown') this.push(packet) // push to all active socket servers - let res = { response:'status pushed off to all clients'} + let res = { response:'status change - pushed off to all clients'} return resolve(res) // this goes back to sender }) }, toggle: function(packet){ return new Promise( async (resolve) => { - // would check status before deciding what to push - if (packet.status===null) packet.status = Math.random()>=.5 ? 'on' : 'off' - else packet.status = (packet.status==='on' ? 'off' : 'on') + // console.log('toggle current status of ', packet.current_status || 'unknown, so random set') + this.switches[packet.id-1] = this.switches[packet.id-1]==='on' ? 'off' : 'on' + packet.state = this.switches[packet.id-1] packet.cmd ='switch/status' packet.sender= packet.sender || (packet._header ? packet._header.sender.name : 'unknown') this.push(packet) // push to all active socket servers - let res = { response:`command ${packet.cmd} with id:${packet.id} pushed to all consumers(clients)`} + let res = { response:'status change - pushed toggled state to all clients'} return resolve(res) // this goes back to sender }) } @@ -40,37 +51,40 @@ const socketfuncs = { } -function status(state,consumer) { +// client processing function +function status(transport) { return (packet) => { return new Promise( async (resolve) => { - // console.log('complete packet', packet, consumer) - console.log(`Switch ${packet.id} is ${packet.status}, sent by ${packet.sender || packet.data.sender} to ${consumer}`) + console.log('=== a by transport processor only function ====') + console.log(`Switch ${packet.id} is ${packet.state}, sent by ${packet.sender || packet.data.sender} to ${transport}`) + console.log('==================') return resolve() }) } } -let fio = new Base({sockets:'uc#c>n,us#s>n,tc#c>t,ts#s>t', tc:{port:8100}, ts:{port:8100}, webs:{ port:8090 }, mqtts:{ topics:['switch/on','switch/off','switch/toggle']}, mqtt:{ topics:['switch/status']}}) +let fio = new Base({sockets:'uc#c>n,us#s>n,tc#c>t,ts#s>t', tc:{port:8100}, ts:{port:8100}}) -fio.s = socketfuncs -fio.c = { reply: () => {return Promise.resolve()} } -fio.cn = {switch:{status:status('on','named')}} -fio.ct = {switch:{status:status('on','tcp')}} -fio.cm = {switch:{status:status('on','mqtt')}} +fio.switches = ['off','off','off','off'] // database to hold switch states +fio.actions = socketfuncs +fio.addNamespace('actions') +fio.amendConsumerCommands({switch: {status:status('tcp only processor function which superceeds the all transports')}},'t') +fio.amendConsumerCommands({switch: {status:status('default all transports function')}}) ; (async () => { - await fio.addSocket('mqtt','s','m',{ topics:['switch/on','switch/off','switch/toggle']}) + await fio.addSocket('mqtt','s','m',{ host:'nas.kebler.net',topics:['switch/on','switch/off','switch/toggle']}) + await fio.addSocket('ha','s','m',{ host:'nas.kebler.net',topics:['fio/switch/set/#']}) + hahooks.call(fio,'ha') + await fio.addSocket('web','s','w',{ port:8090 }) let res = await fio.init() console.log('initialize errors',res) - console.log('waiting for packets') - let packet = {} packet = {cmd:'switch/toggle', id:'1'} console.log('=====sending to socket uc======',packet) - console.log('this should get pushed to all listening') - console.log('response back to uc: ',(await fio.send('uc',packet)).response) + console.log('this should get pushed to all listening consumers') + console.log('direct response back to uc with await: ',(await fio.send('uc',packet)).response) })().catch(err => { diff --git a/examples/ha-mqtt.js b/examples/ha-mqtt.js index a370475..e2fbd59 100644 --- a/examples/ha-mqtt.js +++ b/examples/ha-mqtt.js @@ -1,108 +1,41 @@ -import Base from '../src/base' - -const BROKER = 'nas.kebler.net' -const TOPICS = ['set/testing/+'] // listen for a set command - -const commands = { - on: function(packet){ - return new Promise( async (resolve) => { - console.log(`turning switch on for id ${packet.id||packet.data}`) - console.log('entire packet',packet) - // call switch on here - let res = {} - res.cmd='status' - res.state='on' - res.id = packet.id - this.push(packet) - return resolve(res) - }) - }, - off: function(packet){ - return new Promise( async (resolve) => { - console.log(packet) - console.log(`turning switch off for id ${packet.id||packet.data}`) - // call switch on here - let res = {} - res.cmd='status' - res.state='off' - res.id = packet.id - return resolve(res) - }) - } -} - -let relays = new Base({id:'homeassistant-example'}) - -relays.commands = relays.bindFuncs(commands) - -; -(async () => { - await relays.addSocket('mqs','s','m', {host:BROKER, topics:TOPICS}) - relays.addNamespace('commands','s') - register.call(relays,'mqs') - await relays.init() - -})().catch(err => { - console.error('FATAL: UNABLE TO START SYSTEM!\n',err) - process.kill(process.pid, 'SIGTERM') -}) - - - - ///***************** HOME ASSISTANT ************************ -// formats incoming and outgoing packets for HA convention +// for use with four in one example +// reformats incoming and outgoing topic/payload from HA from/to a UCI json packet +// import this function then call it binding your instance of uci/base +// passing the name of the mqtt socket which will be getting packets from HA +// NOTE: using @uci/ha one can communicate with HA directly not via mqtt -const STATUS_TOPIC = 'status/testing' +const STATUS_TOPIC = 'fio/switch/status' -function register(name) { +export default function register(socketname) { this.beforeProcessHook(async (packet) => { console.log('incoming mqtt packet to modify') console.dir(packet) let modified = Object.assign({},packet) let cmd = packet.cmd.split('/') - modified.cmd = `${packet.data.toLowerCase()}` - modified.id = cmd[2] + modified.cmd = `${cmd[1]}/${packet.data.toLowerCase()}` + modified.id = cmd[3] delete modified.data console.log('translated to uci packet') console.dir(modified) return modified // return packet }, - {name:name}) + {name:socketname}) - this.afterProcessHook(async (packet) => { - console.log('processed packet available to modify again', packet) - if (packet.error) { - let npacket = {} - npacket.cmd = 'error' - npacket.payload = JSON.stringify(packet) - return npacket - } - if (packet.cmd === 'status') { + // will cover push sends which is how HA will know state changed + this.beforeSendHook(async (packet) => { + console.log('beforeSendHook', packet) + if (packet.cmd === 'switch/status') { packet.cmd = `${STATUS_TOPIC}/${packet.id}` - packet.payload = packet.state.toUpperCase() + packet.payload = packet.state console.log('=============modified packet sent to broker================') console.dir(packet) console.log('================') } return packet }, - {name:name}) - - // this.beforeSendHook(async (packet) => { - // console.log('beforeSendHook', packet) - // if (packet.cmd === 'status') { - // let num = Object.keys(packet.pins)[0] - // packet.cmd = `${STATUS_TOPIC}/${num}` - // packet.payload = packet.pins[num] ? 'ON' : 'OFF' - // console.log('=============modified packet sent to broker================') - // console.dir(packet) - // console.log('================') - // } - // return packet - // }, - // {name:name}) + {name:socketname}) } diff --git a/examples/mqtt.js b/examples/mqtt.js deleted file mode 100644 index 0d64923..0000000 --- a/examples/mqtt.js +++ /dev/null @@ -1,66 +0,0 @@ -import Base from '../src/base' - -let dy = new Base({id:'dynamic', useRootNS: true }) - -const HOST = 'nas.kebler.net' - -let sensor = true - -//dummy simulated push -dy.sensor = { - test: function(packet){ - return new Promise( async (resolve) => { - console.log(`doing a dumming sensor push for id ${packet.id||packet.data}`) - console.log('entire packet',packet) - if (sensor) dy.push({cmd:'sensor/on', id:packet.id}) - else dy.push({cmd:'sensor/off', id:packet.id}) - let res = {} - dy.push({cmd:'sensor/on', id:packet.id}) - res.cmd='sensor/test' - res.test=true - res.id = packet.id - return resolve(res) - }) - } -} - -dy.switch = { - on: function(packet){ - return new Promise( async (resolve) => { - console.log(`turning switch on for id ${packet.id||packet.data}`) - console.log('entire packet',packet) - // call switch on here - let res = {} - res.cmd='switch/status' - res.status='on' - res.id = packet.id - return resolve(res) - }) - }, - off: function(packet){ - return new Promise( async (resolve) => { - console.log(packet) - console.log(`turning switch off for id ${packet.id||packet.data}`) - // call switch on here - let res = {} - res.cmd='switch/status' - res.status='off' - res.id = packet.id - return resolve(res) - }) - } -} - - -; -(async () => { - - await dy.init() - await dy.addSocket('mqs','s','m',{host:HOST}) - dy.socket.mqs.subscribe(['lights/#']) - console.log('ready') - -})().catch(err => { - console.error('FATAL: UNABLE TO START SYSTEM!\n',err) - process.kill(process.pid, 'SIGTERM') -}) diff --git a/examples/uci_base_fio.yaml b/examples/uci_base_fio.yaml new file mode 100644 index 0000000..2f7e25e --- /dev/null +++ b/examples/uci_base_fio.yaml @@ -0,0 +1,74 @@ +# package of switches to interface the the fio (four in one) socket example of @uci/base +switch: + - platform: mqtt + name: "FIO Switch 1" + state_topic: "fio/switch/status/1" + command_topic: "fio/switch/set/1" + state_on: "on" + state_off: "off" + payload_on: "on" + payload_off: "off" + icon: mdi:lightbulb + - platform: mqtt + name: "FIO Switch 2" + state_topic: "fio/switch/status/2" + command_topic: "fio/switch/set/2" + state_on: "on" + state_off: "off" + payload_on: "on" + payload_off: "off" + icon: mdi:lightbulb + - platform: mqtt + name: "FIO Switch 3" + state_topic: "fio/switch/status/3" + command_topic: "fio/switch/set/3" + state_on: "on" + state_off: "off" + payload_on: "on" + payload_off: "off" + icon: mdi:lightbulb + - platform: mqtt + name: "FIO Switch 4" + state_topic: "fio/switch/status/4" + command_topic: "fio/switch/set/4" + state_on: "on" + state_off: "off" + payload_on: "on" + payload_off: "off" + icon: mdi:lightbulb + + + # copy and paste and uncomment below as a view under views: in ui-lovelace.yaml + # - title: UCI Base FIO Example + # cards: + # - type: vertical-stack + # cards: + # - type: markdown + # content: > + # # Four In One UCI Base Example + # - type: horizontal-stack + # cards: + # - type: entity-button + # entity: switch.fio_switch_1 + # icon: mdi:water + # name: Switch 1 + # tap_action: + # action: toggle + # - type: entity-button + # entity: switch.fio_switch_2 + # icon: mdi:water + # name: Switch 2 + # tap_action: + # action: toggle + # - type: entity-button + # entity: switch.fio_switch_3 + # icon: mdi:water + # name: Switch 3 + # tap_action: + # action: toggle + # - type: entity-button + # entity: switch.fio_switch_4 + # icon: mdi:water + # name: Switch 4 + # tap_action: + # action: toggle diff --git a/examples/web.js b/examples/web.js deleted file mode 100644 index a3b6d7c..0000000 --- a/examples/web.js +++ /dev/null @@ -1,61 +0,0 @@ -import Base from '../src/base' - -// const USOCKET = __dirname + '/sample.sock' - -let wss = new Base({id:'websocket', useRootNS: true}) - -wss.switch = { - on: function(packet){ - return new Promise( async (resolve) => { - console.log(`turning switch on for id ${packet.id||packet.payload.id}`) - // call switch on here - let res = {} - res.log = `turning switch on for id ${packet.id||packet.payload.id}` - res.cmd='switch/status' - res.status='on' - res.id = packet.id - return resolve(res) - }) - }, - off: function(packet){ - return new Promise( async (resolve) => { - console.log(`turning switch off for id ${packet.id||packet.data}`) - // call switch on here - let res = {} - res.cmd='switch/status' - res.status='off' - res.id = packet.id - return resolve(res) - }) - }, - toggle: function(packet){ - return new Promise( async (resolve) => { - console.log(`toggling switch for id ${packet.id||packet.data}`) - // call switch on here - let res = {} - res.cmd='switch/status' - res.status= (packet.status === 'on')?'off':'on' - res.id = packet.id - console.log('broadcast',res) - this.push(res) - // return only acknowledge to sender, packet went as push - res = { cmd:'ack'} - return resolve(res) - }) - } -} - - -; -(async () => { - - await wss.init() - await wss.addSocket('web','s','w') - wss.push({server:'started'}) - await wss.addSocket('mqs','s','m') - wss.socket.mqs.subscribe(['switch/on','switch/off','switch/toggle']) - -})().catch(err => { - console.error('FATAL: UNABLE TO START SYSTEM!\n',err) - process.kill(process.pid, 'SIGTERM') -}) diff --git a/examples/ws-fio-client/.editorconfig b/examples/ws-fio-client/.editorconfig new file mode 100644 index 0000000..9d08a1a --- /dev/null +++ b/examples/ws-fio-client/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/examples/ws-fio-client/.eslintignore b/examples/ws-fio-client/.eslintignore new file mode 100644 index 0000000..9b1c8b1 --- /dev/null +++ b/examples/ws-fio-client/.eslintignore @@ -0,0 +1 @@ +/dist diff --git a/examples/ws-fio-client/.eslintrc.js b/examples/ws-fio-client/.eslintrc.js new file mode 100644 index 0000000..a789acd --- /dev/null +++ b/examples/ws-fio-client/.eslintrc.js @@ -0,0 +1,55 @@ +module.exports = { + root: true, + + parserOptions: { + parser: 'babel-eslint', + sourceType: 'module' + }, + + env: { + browser: true + }, + + extends: [ + // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention + // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules. + 'plugin:vue/essential', + '@vue/standard' + ], + + // required to lint *.vue files + plugins: [ + 'vue' + ], + + globals: { + 'ga': true, // Google Analytics + 'cordova': true, + '__statics': true, + 'process': true + }, + + // add your custom rules here + rules: { + // allow async-await + 'generator-star-spacing': 'off', + // allow paren-less arrow functions + 'arrow-parens': 'off', + 'one-var': 'off', + + 'import/first': 'off', + 'import/named': 'error', + 'import/namespace': 'error', + 'import/default': 'error', + 'import/export': 'error', + 'import/extensions': 'off', + 'import/no-unresolved': 'off', + 'import/no-extraneous-dependencies': 'off', + 'prefer-promise-reject-errors': 'off', + + // allow console.log during development only + 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', + // allow debugger during development only + 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' + } +} diff --git a/examples/ws-fio-client/.gitignore b/examples/ws-fio-client/.gitignore new file mode 100644 index 0000000..d7c7a2d --- /dev/null +++ b/examples/ws-fio-client/.gitignore @@ -0,0 +1,20 @@ +.quasar +.DS_Store +.thumbs.db +node_modules +/dist +/src-cordova/node_modules +/src-cordova/platforms +/src-cordova/plugins +/src-cordova/www +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln diff --git a/examples/ws-fio-client/.postcssrc.js b/examples/ws-fio-client/.postcssrc.js new file mode 100644 index 0000000..1174fe5 --- /dev/null +++ b/examples/ws-fio-client/.postcssrc.js @@ -0,0 +1,8 @@ +// https://github.com/michael-ciniawsky/postcss-load-config + +module.exports = { + plugins: [ + // to edit target browsers: use "browserslist" field in package.json + require('autoprefixer') + ] +} diff --git a/examples/ws-fio-client/.stylintrc b/examples/ws-fio-client/.stylintrc new file mode 100644 index 0000000..ce38d77 --- /dev/null +++ b/examples/ws-fio-client/.stylintrc @@ -0,0 +1,35 @@ +{ + "blocks": "never", + "brackets": "never", + "colons": "never", + "colors": "always", + "commaSpace": "always", + "commentSpace": "always", + "cssLiteral": "never", + "depthLimit": false, + "duplicates": true, + "efficient": "always", + "extendPref": false, + "globalDupe": true, + "indentPref": 2, + "leadingZero": "never", + "maxErrors": false, + "maxWarnings": false, + "mixed": false, + "namingConvention": false, + "namingConventionStrict": false, + "none": "never", + "noImportant": false, + "parenSpace": "never", + "placeholder": false, + "prefixVarsWithDollar": "always", + "quotePref": "single", + "semicolons": "never", + "sortOrder": false, + "stackedProperties": "never", + "trailingWhitespace": "never", + "universal": "never", + "valid": true, + "zeroUnits": "never", + "zIndexNormalize": false +} diff --git a/examples/ws-fio-client/README.md b/examples/ws-fio-client/README.md new file mode 100644 index 0000000..0f7d653 --- /dev/null +++ b/examples/ws-fio-client/README.md @@ -0,0 +1,26 @@ +# Quasar App (test-client-new) + +a test websocket client for uci websocket server + +## Install the dependencies +```bash +yarn +``` + +### Start the app in development mode (hot-code reloading, error reporting, etc.) +```bash +quasar dev +``` + +### Lint the files +```bash +yarn run lint +``` + +### Build the app for production +```bash +quasar build +``` + +### Customize the configuration +See [Configuring quasar.conf.js](https://quasar.dev/quasar-cli/quasar-conf-js). diff --git a/examples/ws-fio-client/babel.config.js b/examples/ws-fio-client/babel.config.js new file mode 100644 index 0000000..9408c6c --- /dev/null +++ b/examples/ws-fio-client/babel.config.js @@ -0,0 +1,5 @@ +module.exports = { + presets: [ + '@quasar/babel-preset-app' + ] +} diff --git a/examples/ws-fio-client/package.json b/examples/ws-fio-client/package.json new file mode 100644 index 0000000..a1310c7 --- /dev/null +++ b/examples/ws-fio-client/package.json @@ -0,0 +1,35 @@ +{ + "name": "fio-client", + "version": "0.0.1", + "description": "a websocket client for use with the fiod example", + "productName": "Websocket Client", + "cordovaId": "org.cordova.quasar.app", + "author": "David Kebler ", + "private": true, + "scripts": { + "lint": "eslint --ext .js,.vue src", + "client": "WSS=ws://localhost:8090 ./node_modules/.bin/quasar dev" + }, + "dependencies": { + "@quasar/extras": "^1.2.0", + "@uci/websocket-client": "^0.1.7", + "quasar": "^1.0.0", + "rfs": "^8.0.4" + }, + "devDependencies": { + "@quasar/app": "^1.0.0", + "@vue/eslint-config-standard": "^4.0.0", + "babel-eslint": "^10.0.1", + "eslint": "^5.10.0", + "eslint-loader": "^2.1.1", + "eslint-plugin-vue": "^5.0.0" + }, + "engines": { + "node": ">= 8.9.0", + "npm": ">= 5.6.0", + "yarn": ">= 1.6.0" + }, + "browserslist": [ + "last 1 version, not dead, ie >= 11" + ] +} diff --git a/examples/ws-fio-client/quasar.conf.js b/examples/ws-fio-client/quasar.conf.js new file mode 100644 index 0000000..be3bca9 --- /dev/null +++ b/examples/ws-fio-client/quasar.conf.js @@ -0,0 +1,182 @@ +// Configuration for your app +// https://quasar.dev/quasar-cli/quasar-conf-js + +module.exports = function (ctx) { + return { + // app boot file (/src/boot) + // --> boot files are part of "main.js" + // boot used to be plugins + boot: ['socket'], // uci-consumer-client websocket + css: [ + 'app.styl' + ], + + extras: [ + // 'ionicons-v4', + // 'mdi-v3', + // 'fontawesome-v5', + // 'eva-icons', + // 'themify', + // 'roboto-font-latin-ext', // this or either 'roboto-font', NEVER both! + // 'roboto-font', // optional, you are not bound to it + 'material-icons' // optional, you are not bound to it + ], + + framework: { + // iconSet: 'ionicons-v4', + // lang: 'de', // Quasar language + + // all: true, // --- includes everything; for dev only! + + components: [ + 'QLayout', + 'QHeader', + 'QDrawer', + 'QPageContainer', + 'QPage', + 'QToolbar', + 'QToolbarTitle', + 'QBtn', + 'QIcon', + 'QList', + 'QItem', + 'QItemSection', + 'QItemLabel', + 'QInput', + 'QSelect', + 'QField', + 'QFooter', + 'QTooltip' + ], + + directives: [ + 'Ripple' + ], + + // Quasar plugins + plugins: [ + 'Notify' + ] + }, + + supportIE: false, + + build: { + // added to support communication with websocket and backend database + env: ctx.dev + // pass environment variable to browser client + ? { // so on dev we'll have + DBURL: JSON.stringify(process.env.DBURL || 'ws://localhost:3030'), + WSS: JSON.stringify(process.env.WSS || 'ws://localhost:8090') + } + : { // and on build (production): + DBURL: JSON.stringify(process.env.DBURL || 'ws://switches.kebler.net:3030'), + WSS: JSON.stringify(process.env.WSS || 'ws://relays.kebler.net:8090') + }, + scopeHoisting: true, + vueRouterMode: 'history', + // vueCompiler: true, + // gzip: true, + // analyze: true, + // extractCSS: false, + extendWebpack (cfg) { + cfg.module.rules.push({ + enforce: 'pre', + test: /\.(js|vue)$/, + loader: 'eslint-loader', + exclude: /node_modules/, + options: { + formatter: require('eslint').CLIEngine.getFormatter('stylish') + } + }) + } + }, + + devServer: { + // https: true, + // port: 8080, + open: true // opens browser window automatically + }, + + // animations: 'all', // --- includes all animations + animations: [], + + ssr: { + pwa: false + }, + + pwa: { + // workboxPluginMode: 'InjectManifest', + // workboxOptions: {}, // only for NON InjectManifest + manifest: { + // name: 'Quasar App', + // short_name: 'Quasar App', + // description: 'a test websocket client for uci websocket server', + display: 'standalone', + orientation: 'portrait', + background_color: '#ffffff', + theme_color: '#027be3', + icons: [ + { + 'src': 'statics/icons/icon-128x128.png', + 'sizes': '128x128', + 'type': 'image/png' + }, + { + 'src': 'statics/icons/icon-192x192.png', + 'sizes': '192x192', + 'type': 'image/png' + }, + { + 'src': 'statics/icons/icon-256x256.png', + 'sizes': '256x256', + 'type': 'image/png' + }, + { + 'src': 'statics/icons/icon-384x384.png', + 'sizes': '384x384', + 'type': 'image/png' + }, + { + 'src': 'statics/icons/icon-512x512.png', + 'sizes': '512x512', + 'type': 'image/png' + } + ] + } + }, + + cordova: { + // id: 'org.cordova.quasar.app', + // noIosLegacyBuildFlag: true, // uncomment only if you know what you are doing + }, + + electron: { + // bundler: 'builder', // or 'packager' + + extendWebpack (cfg) { + // do something with Electron main process Webpack cfg + // chainWebpack also available besides this extendWebpack + }, + + packager: { + // https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#options + + // OS X / Mac App Store + // appBundleId: '', + // appCategoryType: '', + // osxSign: '', + // protocol: 'myapp://path', + + // Windows only + // win32metadata: { ... } + }, + + builder: { + // https://www.electron.build/configuration/configuration + + // appId: 'test-client-new' + } + } + } +} diff --git a/examples/ws-fio-client/src/App.vue b/examples/ws-fio-client/src/App.vue new file mode 100644 index 0000000..3fa5037 --- /dev/null +++ b/examples/ws-fio-client/src/App.vue @@ -0,0 +1,14 @@ + + + + + diff --git a/examples/ws-fio-client/src/assets/quasar-logo-full.svg b/examples/ws-fio-client/src/assets/quasar-logo-full.svg new file mode 100644 index 0000000..281d072 --- /dev/null +++ b/examples/ws-fio-client/src/assets/quasar-logo-full.svg @@ -0,0 +1,191 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/ws-fio-client/src/assets/sad.svg b/examples/ws-fio-client/src/assets/sad.svg new file mode 100644 index 0000000..628136f --- /dev/null +++ b/examples/ws-fio-client/src/assets/sad.svg @@ -0,0 +1 @@ + diff --git a/examples/ws-fio-client/src/boot/.gitkeep b/examples/ws-fio-client/src/boot/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/examples/ws-fio-client/src/boot/socket.js b/examples/ws-fio-client/src/boot/socket.js new file mode 100644 index 0000000..0c1f8bd --- /dev/null +++ b/examples/ws-fio-client/src/boot/socket.js @@ -0,0 +1,11 @@ +// import WebSocket from '@uci/websocket-client' +import WebSocket from '@uci/websocket-client' + +const ws = new WebSocket(process.env.WSS || 'ws://0.0.0.0:8090') + +export { ws } + +// leave the export, even if you don't use it +export default ({ Vue }) => { + Vue.prototype.$socket = ws +} diff --git a/examples/ws-fio-client/src/components/.gitkeep b/examples/ws-fio-client/src/components/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/examples/ws-fio-client/src/css/app.styl b/examples/ws-fio-client/src/css/app.styl new file mode 100644 index 0000000..c1c263e --- /dev/null +++ b/examples/ws-fio-client/src/css/app.styl @@ -0,0 +1,59 @@ +// app global css +// from https://github.com/quasarframework/quasar/tree/dev/ui/src/css + + +@import "../../node_modules/rfs/stylus" + +$rfs-base-font-size = 1.25rem +// $rfs-font-size-unit = rem +$rfs-breakpoint = 1400px +// $rfs-breakpoint-unit = px +// $rfs-factor = 10 +// $rfs-rem-value = 16 +$rfs-two-dimensional = true +// $rfs-class = false + +$field-font-factor = 1.3 +$field-label-font-factor = 1 + +.q-field__native +.q-item__label + rfs($rfs-base-font-size * $field-font-factor) + +.q-field__label + &.no-pointer-events + rfs($rfs-base-font-size * $field-font-factor) + +.q-field__label + rfs($rfs-base-font-size * $field-label-font-factor) + padding-bottom .3em // needs to be dynamic based on font size + +.q-field__control + // height +??px // needs to be computed based on font size. + + +.q-page-container + background $accent + display: flex; + justify-content: center; +.q-page + width 80% +.q-field + padding 0 +.q-input +.q-select + background white + padding 0 .2em + margin .2em +.response + .q-textarea + .q-input + background $secondary + padding 0 1em +.q-item + padding 0 + margin 0 +.greyedout + opacity 0.5 +input + fontsize-12 diff --git a/examples/ws-fio-client/src/css/quasar.variables.styl b/examples/ws-fio-client/src/css/quasar.variables.styl new file mode 100644 index 0000000..e7b9d78 --- /dev/null +++ b/examples/ws-fio-client/src/css/quasar.variables.styl @@ -0,0 +1,21 @@ +// Quasar Stylus Variables +// -------------------------------------------------- +// To customize the look and feel of this app, you can override +// the Stylus variables found in Quasar's source Stylus files. + +// Check documentation for full list of Quasar variables + +// It's highly recommended to change the default colors +// to match your app's branding. +// Tip: Use the "Theme Builder" on Quasar's documentation website. +// https://quasar.dev/style/theme-builder + + +$primary = #006cd6 +$secondary = #26A69A +$accent = #278eb0 + +$positive = #21BA45 +$negative = #C10015 +$info = #31CCEC +$warning = #F2C037 diff --git a/examples/ws-fio-client/src/css/variables.styl.core b/examples/ws-fio-client/src/css/variables.styl.core new file mode 100644 index 0000000..cdcfd51 --- /dev/null +++ b/examples/ws-fio-client/src/css/variables.styl.core @@ -0,0 +1,639 @@ +$space-base ?= 16px +$space-x-base ?= $space-base +$space-y-base ?= $space-base +$spaces ?= { + none: { + x: 0, + y: 0 + }, + xs: { + x: ($space-x-base * .25), + y: ($space-y-base * .25) + }, + sm: { + x: ($space-x-base * .5), + y: ($space-y-base * .5) + }, + md: { + x: $space-x-base, + y: $space-y-base + }, + lg: { + x: ($space-x-base * 1.5), + y: ($space-y-base * 1.5) + }, + xl: { + x: ($space-x-base * 3), + y: ($space-y-base * 3) + } +} + +// Max width at which point +// current size ends +$breakpoint-xs ?= 599px +$breakpoint-sm ?= 1023px +$breakpoint-md ?= 1439px +$breakpoint-lg ?= 1919px + +$flex-cols ?= 12 +$flex-gutter-xs ?= ($space-base * .25) +$flex-gutter-sm ?= ($space-base * .5) +$flex-gutter-md ?= $space-base +$flex-gutter-lg ?= ($space-base * 1.5) +$flex-gutter-xl ?= ($space-base * 3) + +$body-font-size ?= 14px +$body-line-height ?= 1.5 + +$flex-gutter ?= { + none: 0, + xs: $flex-gutter-xs, + sm: $flex-gutter-sm, + md: $flex-gutter-md, + lg: $flex-gutter-lg, + xl: $flex-gutter-xl +} +$sizes ?= { + xs: 0, // Extra small screen + sm: $breakpoint-xs + 1, // Small screen + md: $breakpoint-sm + 1, // Medium screen + lg: $breakpoint-md + 1, // Large screen + xl: $breakpoint-lg + 1 // Extra large screen +} + +$breakpoint-xs-min ?= 0 +$breakpoint-xs-max ?= $breakpoint-xs + +$breakpoint-sm-min ?= $sizes.sm +$breakpoint-sm-max ?= $breakpoint-sm + +$breakpoint-md-min ?= $sizes.md +$breakpoint-md-max ?= $breakpoint-md + +$breakpoint-lg-min ?= $sizes.lg +$breakpoint-lg-max ?= $breakpoint-lg + +$breakpoint-xl-min ?= $sizes.xl +$breakpoint-xl-max ?= 9999px + +$headings ?= { + h1: { + size: 6rem, + line-height: 6rem, + weight: 300, + letter-spacing: -.01562em + }, + h2: { + size: 3.75rem, + line-height: 3.75rem, + letter-spacing: -.00833em, + weight: 300 + }, + h3: { + size: 3rem, + line-height: 3.125rem, + letter-spacing: normal, + weight: 400 + }, + h4: { + size: 2.125rem, + line-height: 2.5rem, + letter-spacing: .00735em, + weight: 400 + }, + h5: { + size: 1.5rem, + line-height: 2rem, + letter-spacing: normal, + weight: 400 + }, + h6: { + size: 1.25rem, + line-height: 2rem, + letter-spacing: .0125em, + weight: 500 + }, + subtitle1: { + size: 1rem, + line-height: 1.75rem, + letter-spacing: .00937em, + weight: 400 + }, + subtitle2: { + size: .875rem, + line-height: 1.375rem, + letter-spacing: .00714em, + weight: 500 + }, + body1: { + size: 1rem, + line-height: 1.5rem, + letter-spacing: .03125em, + weight: 400 + }, + body2: { + size: .875rem, + line-height: 1.25rem, + letter-spacing: .01786em, + weight: 400 + }, + overline: { + size: .75rem, + line-height: 2rem, + letter-spacing: .16667em, + weight: 500 + }, + caption: { + size: .75rem, + line-height: 1.25rem, + letter-spacing: .03333em, + weight: 400 + } +} + +$h-tags ?= { + h1: $headings.h1, + h2: $headings.h2, + h3: $headings.h3, + h4: $headings.h4, + h5: $headings.h5, + h6: $headings.h6 +} + +$text-weights ?= { + thin: 100, + light: 300, + regular: 400, + medium: 500, + bold: 700, + bolder: 900 +} + +$primary ?= #027BE3 +$secondary ?= #26A69A +$accent ?= #9C27B0 + +$positive ?= #21BA45 +$negative ?= #C10015 +$info ?= #31CCEC +$warning ?= #F2C037 + +$light ?= #bdbdbd +$dark ?= #424242 +$faded ?= #777 + +$dimmed-background ?= rgba(0, 0, 0, .4) +$light-dimmed-background ?= rgba(255, 255, 255, .6) + +$separator-color ?= rgba(0, 0, 0, .12) +$separator-dark-color ?= rgba(255, 255, 255, .48) + +$red ?= #f44336 +$red-1 ?= #ffebee +$red-2 ?= #ffcdd2 +$red-3 ?= #ef9a9a +$red-4 ?= #e57373 +$red-5 ?= #ef5350 +$red-6 ?= #f44336 +$red-7 ?= #e53935 +$red-8 ?= #d32f2f +$red-9 ?= #c62828 +$red-10 ?= #b71c1c +$red-11 ?= #ff8a80 +$red-12 ?= #ff5252 +$red-13 ?= #ff1744 +$red-14 ?= #d50000 +$pink ?= #e91e63 +$pink-1 ?= #fce4ec +$pink-2 ?= #f8bbd0 +$pink-3 ?= #f48fb1 +$pink-4 ?= #f06292 +$pink-5 ?= #ec407a +$pink-6 ?= #e91e63 +$pink-7 ?= #d81b60 +$pink-8 ?= #c2185b +$pink-9 ?= #ad1457 +$pink-10 ?= #880e4f +$pink-11 ?= #ff80ab +$pink-12 ?= #ff4081 +$pink-13 ?= #f50057 +$pink-14 ?= #c51162 +$purple ?= #9c27b0 +$purple-1 ?= #f3e5f5 +$purple-2 ?= #e1bee7 +$purple-3 ?= #ce93d8 +$purple-4 ?= #ba68c8 +$purple-5 ?= #ab47bc +$purple-6 ?= #9c27b0 +$purple-7 ?= #8e24aa +$purple-8 ?= #7b1fa2 +$purple-9 ?= #6a1b9a +$purple-10 ?= #4a148c +$purple-11 ?= #ea80fc +$purple-12 ?= #e040fb +$purple-13 ?= #d500f9 +$purple-14 ?= #aa00ff +$deep-purple ?= #673ab7 +$deep-purple-1 ?= #ede7f6 +$deep-purple-2 ?= #d1c4e9 +$deep-purple-3 ?= #b39ddb +$deep-purple-4 ?= #9575cd +$deep-purple-5 ?= #7e57c2 +$deep-purple-6 ?= #673ab7 +$deep-purple-7 ?= #5e35b1 +$deep-purple-8 ?= #512da8 +$deep-purple-9 ?= #4527a0 +$deep-purple-10 ?= #311b92 +$deep-purple-11 ?= #b388ff +$deep-purple-12 ?= #7c4dff +$deep-purple-13 ?= #651fff +$deep-purple-14 ?= #6200ea +$indigo ?= #3f51b5 +$indigo-1 ?= #e8eaf6 +$indigo-2 ?= #c5cae9 +$indigo-3 ?= #9fa8da +$indigo-4 ?= #7986cb +$indigo-5 ?= #5c6bc0 +$indigo-6 ?= #3f51b5 +$indigo-7 ?= #3949ab +$indigo-8 ?= #303f9f +$indigo-9 ?= #283593 +$indigo-10 ?= #1a237e +$indigo-11 ?= #8c9eff +$indigo-12 ?= #536dfe +$indigo-13 ?= #3d5afe +$indigo-14 ?= #304ffe +$blue ?= #2196f3 +$blue-1 ?= #e3f2fd +$blue-2 ?= #bbdefb +$blue-3 ?= #90caf9 +$blue-4 ?= #64b5f6 +$blue-5 ?= #42a5f5 +$blue-6 ?= #2196f3 +$blue-7 ?= #1e88e5 +$blue-8 ?= #1976d2 +$blue-9 ?= #1565c0 +$blue-10 ?= #0d47a1 +$blue-11 ?= #82b1ff +$blue-12 ?= #448aff +$blue-13 ?= #2979ff +$blue-14 ?= #2962ff +$light-blue ?= #03a9f4 +$light-blue-1 ?= #e1f5fe +$light-blue-2 ?= #b3e5fc +$light-blue-3 ?= #81d4fa +$light-blue-4 ?= #4fc3f7 +$light-blue-5 ?= #29b6f6 +$light-blue-6 ?= #03a9f4 +$light-blue-7 ?= #039be5 +$light-blue-8 ?= #0288d1 +$light-blue-9 ?= #0277bd +$light-blue-10 ?= #01579b +$light-blue-11 ?= #80d8ff +$light-blue-12 ?= #40c4ff +$light-blue-13 ?= #00b0ff +$light-blue-14 ?= #0091ea +$cyan ?= #00bcd4 +$cyan-1 ?= #e0f7fa +$cyan-2 ?= #b2ebf2 +$cyan-3 ?= #80deea +$cyan-4 ?= #4dd0e1 +$cyan-5 ?= #26c6da +$cyan-6 ?= #00bcd4 +$cyan-7 ?= #00acc1 +$cyan-8 ?= #0097a7 +$cyan-9 ?= #00838f +$cyan-10 ?= #006064 +$cyan-11 ?= #84ffff +$cyan-12 ?= #18ffff +$cyan-13 ?= #00e5ff +$cyan-14 ?= #00b8d4 +$teal ?= #009688 +$teal-1 ?= #e0f2f1 +$teal-2 ?= #b2dfdb +$teal-3 ?= #80cbc4 +$teal-4 ?= #4db6ac +$teal-5 ?= #26a69a +$teal-6 ?= #009688 +$teal-7 ?= #00897b +$teal-8 ?= #00796b +$teal-9 ?= #00695c +$teal-10 ?= #004d40 +$teal-11 ?= #a7ffeb +$teal-12 ?= #64ffda +$teal-13 ?= #1de9b6 +$teal-14 ?= #00bfa5 +$green ?= #4caf50 +$green-1 ?= #e8f5e9 +$green-2 ?= #c8e6c9 +$green-3 ?= #a5d6a7 +$green-4 ?= #81c784 +$green-5 ?= #66bb6a +$green-6 ?= #4caf50 +$green-7 ?= #43a047 +$green-8 ?= #388e3c +$green-9 ?= #2e7d32 +$green-10 ?= #1b5e20 +$green-11 ?= #b9f6ca +$green-12 ?= #69f0ae +$green-13 ?= #00e676 +$green-14 ?= #00c853 +$light-green ?= #8bc34a +$light-green-1 ?= #f1f8e9 +$light-green-2 ?= #dcedc8 +$light-green-3 ?= #c5e1a5 +$light-green-4 ?= #aed581 +$light-green-5 ?= #9ccc65 +$light-green-6 ?= #8bc34a +$light-green-7 ?= #7cb342 +$light-green-8 ?= #689f38 +$light-green-9 ?= #558b2f +$light-green-10 ?= #33691e +$light-green-11 ?= #ccff90 +$light-green-12 ?= #b2ff59 +$light-green-13 ?= #76ff03 +$light-green-14 ?= #64dd17 +$lime ?= #cddc39 +$lime-1 ?= #f9fbe7 +$lime-2 ?= #f0f4c3 +$lime-3 ?= #e6ee9c +$lime-4 ?= #dce775 +$lime-5 ?= #d4e157 +$lime-6 ?= #cddc39 +$lime-7 ?= #c0ca33 +$lime-8 ?= #afb42b +$lime-9 ?= #9e9d24 +$lime-10 ?= #827717 +$lime-11 ?= #f4ff81 +$lime-12 ?= #eeff41 +$lime-13 ?= #c6ff00 +$lime-14 ?= #aeea00 +$yellow ?= #ffeb3b +$yellow-1 ?= #fffde7 +$yellow-2 ?= #fff9c4 +$yellow-3 ?= #fff59d +$yellow-4 ?= #fff176 +$yellow-5 ?= #ffee58 +$yellow-6 ?= #ffeb3b +$yellow-7 ?= #fdd835 +$yellow-8 ?= #fbc02d +$yellow-9 ?= #f9a825 +$yellow-10 ?= #f57f17 +$yellow-11 ?= #ffff8d +$yellow-12 ?= #ffff00 +$yellow-13 ?= #ffea00 +$yellow-14 ?= #ffd600 +$amber ?= #ffc107 +$amber-1 ?= #fff8e1 +$amber-2 ?= #ffecb3 +$amber-3 ?= #ffe082 +$amber-4 ?= #ffd54f +$amber-5 ?= #ffca28 +$amber-6 ?= #ffc107 +$amber-7 ?= #ffb300 +$amber-8 ?= #ffa000 +$amber-9 ?= #ff8f00 +$amber-10 ?= #ff6f00 +$amber-11 ?= #ffe57f +$amber-12 ?= #ffd740 +$amber-13 ?= #ffc400 +$amber-14 ?= #ffab00 +$orange ?= #ff9800 +$orange-1 ?= #fff3e0 +$orange-2 ?= #ffe0b2 +$orange-3 ?= #ffcc80 +$orange-4 ?= #ffb74d +$orange-5 ?= #ffa726 +$orange-6 ?= #ff9800 +$orange-7 ?= #fb8c00 +$orange-8 ?= #f57c00 +$orange-9 ?= #ef6c00 +$orange-10 ?= #e65100 +$orange-11 ?= #ffd180 +$orange-12 ?= #ffab40 +$orange-13 ?= #ff9100 +$orange-14 ?= #ff6d00 +$deep-orange ?= #ff5722 +$deep-orange-1 ?= #fbe9e7 +$deep-orange-2 ?= #ffccbc +$deep-orange-3 ?= #ffab91 +$deep-orange-4 ?= #ff8a65 +$deep-orange-5 ?= #ff7043 +$deep-orange-6 ?= #ff5722 +$deep-orange-7 ?= #f4511e +$deep-orange-8 ?= #e64a19 +$deep-orange-9 ?= #d84315 +$deep-orange-10 ?= #bf360c +$deep-orange-11 ?= #ff9e80 +$deep-orange-12 ?= #ff6e40 +$deep-orange-13 ?= #ff3d00 +$deep-orange-14 ?= #dd2c00 +$brown ?= #795548 +$brown-1 ?= #efebe9 +$brown-2 ?= #d7ccc8 +$brown-3 ?= #bcaaa4 +$brown-4 ?= #a1887f +$brown-5 ?= #8d6e63 +$brown-6 ?= #795548 +$brown-7 ?= #6d4c41 +$brown-8 ?= #5d4037 +$brown-9 ?= #4e342e +$brown-10 ?= #3e2723 +$brown-11 ?= #d7ccc8 +$brown-12 ?= #bcaaa4 +$brown-13 ?= #8d6e63 +$brown-14 ?= #5d4037 +$grey ?= #9e9e9e +$grey-1 ?= #fafafa +$grey-2 ?= #f5f5f5 +$grey-3 ?= #eeeeee +$grey-4 ?= #e0e0e0 +$grey-5 ?= #bdbdbd +$grey-6 ?= #9e9e9e +$grey-7 ?= #757575 +$grey-8 ?= #616161 +$grey-9 ?= #424242 +$grey-10 ?= #212121 +$grey-11 ?= #f5f5f5 +$grey-12 ?= #eeeeee +$grey-13 ?= #bdbdbd +$grey-14 ?= #616161 +$blue-grey ?= #607d8b +$blue-grey-1 ?= #eceff1 +$blue-grey-2 ?= #cfd8dc +$blue-grey-3 ?= #b0bec5 +$blue-grey-4 ?= #90a4ae +$blue-grey-5 ?= #78909c +$blue-grey-6 ?= #607d8b +$blue-grey-7 ?= #546e7a +$blue-grey-8 ?= #455a64 +$blue-grey-9 ?= #37474f +$blue-grey-10 ?= #263238 +$blue-grey-11 ?= #cfd8dc +$blue-grey-12 ?= #b0bec5 +$blue-grey-13 ?= #78909c +$blue-grey-14 ?= #455a64 + +$ios-statusbar-height ?= 20px + +$z-fab ?= 990 +$z-side ?= 1000 +$z-marginals ?= 2000 +$z-fixed-drawer ?= 3000 +$z-fullscreen ?= 6000 +$z-menu ?= 6000 +$z-top ?= 7000 +$z-tooltip ?= 9000 +$z-notify ?= 9500 +$z-max ?= 9998 + +$shadow-color ?= black +$shadow-transition ?= box-shadow .28s cubic-bezier(.4, 0, .2, 1) +$inset-shadow ?= 0 7px 9px -7px rgba($shadow-color, .7) inset + +$elevation-umbra ?= rgba($shadow-color, .2) +$elevation-penumbra ?= rgba($shadow-color, .14) +$elevation-ambient ?= rgba($shadow-color, .12) + +$shadow-0 ?= 0 0 0 $elevation-umbra, 0 0 0 $elevation-penumbra, 0 0 0 $elevation-ambient +$shadow-1 ?= 0 1px 3px $elevation-umbra, 0 1px 1px $elevation-penumbra, 0 2px 1px -1px $elevation-ambient +$shadow-2 ?= 0 1px 5px $elevation-umbra, 0 2px 2px $elevation-penumbra, 0 3px 1px -2px $elevation-ambient +$shadow-3 ?= 0 1px 8px $elevation-umbra, 0 3px 4px $elevation-penumbra, 0 3px 3px -2px $elevation-ambient +$shadow-4 ?= 0 2px 4px -1px $elevation-umbra, 0 4px 5px $elevation-penumbra, 0 1px 10px $elevation-ambient +$shadow-5 ?= 0 3px 5px -1px $elevation-umbra, 0 5px 8px $elevation-penumbra, 0 1px 14px $elevation-ambient +$shadow-6 ?= 0 3px 5px -1px $elevation-umbra, 0 6px 10px $elevation-penumbra, 0 1px 18px $elevation-ambient +$shadow-7 ?= 0 4px 5px -2px $elevation-umbra, 0 7px 10px 1px $elevation-penumbra, 0 2px 16px 1px $elevation-ambient +$shadow-8 ?= 0 5px 5px -3px $elevation-umbra, 0 8px 10px 1px $elevation-penumbra, 0 3px 14px 2px $elevation-ambient +$shadow-9 ?= 0 5px 6px -3px $elevation-umbra, 0 9px 12px 1px $elevation-penumbra, 0 3px 16px 2px $elevation-ambient +$shadow-10 ?= 0 6px 6px -3px $elevation-umbra, 0 10px 14px 1px $elevation-penumbra, 0 4px 18px 3px $elevation-ambient +$shadow-11 ?= 0 6px 7px -4px $elevation-umbra, 0 11px 15px 1px $elevation-penumbra, 0 4px 20px 3px $elevation-ambient +$shadow-12 ?= 0 7px 8px -4px $elevation-umbra, 0 12px 17px 2px $elevation-penumbra, 0 5px 22px 4px $elevation-ambient +$shadow-13 ?= 0 7px 8px -4px $elevation-umbra, 0 13px 19px 2px $elevation-penumbra, 0 5px 24px 4px $elevation-ambient +$shadow-14 ?= 0 7px 9px -4px $elevation-umbra, 0 14px 21px 2px $elevation-penumbra, 0 5px 26px 4px $elevation-ambient +$shadow-15 ?= 0 8px 9px -5px $elevation-umbra, 0 15px 22px 2px $elevation-penumbra, 0 6px 28px 5px $elevation-ambient +$shadow-16 ?= 0 8px 10px -5px $elevation-umbra, 0 16px 24px 2px $elevation-penumbra, 0 6px 30px 5px $elevation-ambient +$shadow-17 ?= 0 8px 11px -5px $elevation-umbra, 0 17px 26px 2px $elevation-penumbra, 0 6px 32px 5px $elevation-ambient +$shadow-18 ?= 0 9px 11px -5px $elevation-umbra, 0 18px 28px 2px $elevation-penumbra, 0 7px 34px 6px $elevation-ambient +$shadow-19 ?= 0 9px 12px -6px $elevation-umbra, 0 19px 29px 2px $elevation-penumbra, 0 7px 36px 6px $elevation-ambient +$shadow-20 ?= 0 10px 13px -6px $elevation-umbra, 0 20px 31px 3px $elevation-penumbra, 0 8px 38px 7px $elevation-ambient +$shadow-21 ?= 0 10px 13px -6px $elevation-umbra, 0 21px 33px 3px $elevation-penumbra, 0 8px 40px 7px $elevation-ambient +$shadow-22 ?= 0 10px 14px -6px $elevation-umbra, 0 22px 35px 3px $elevation-penumbra, 0 8px 42px 7px $elevation-ambient +$shadow-23 ?= 0 11px 14px -7px $elevation-umbra, 0 23px 36px 3px $elevation-penumbra, 0 9px 44px 8px $elevation-ambient +$shadow-24 ?= 0 11px 15px -7px $elevation-umbra, 0 24px 38px 3px $elevation-penumbra, 0 9px 46px 8px $elevation-ambient + +$shadow-up-0 ?= 0 0 0 $elevation-umbra, 0 0 0 $elevation-penumbra, 0 0 0 $elevation-ambient +$shadow-up-1 ?= 0 -1px 3px $elevation-umbra, 0 -1px 1px $elevation-penumbra, 0 -2px 1px -1px $elevation-ambient +$shadow-up-2 ?= 0 -1px 5px $elevation-umbra, 0 -2px 2px $elevation-penumbra, 0 -3px 1px -2px $elevation-ambient +$shadow-up-3 ?= 0 -1px 8px $elevation-umbra, 0 -3px 4px $elevation-penumbra, 0 -3px 3px -2px $elevation-ambient +$shadow-up-4 ?= 0 -2px 4px -1px $elevation-umbra, 0 -4px 5px $elevation-penumbra, 0 -1px 10px $elevation-ambient +$shadow-up-5 ?= 0 -3px 5px -1px $elevation-umbra, 0 -5px 8px $elevation-penumbra, 0 -1px 14px $elevation-ambient +$shadow-up-6 ?= 0 -3px 5px -1px $elevation-umbra, 0 -6px 10px $elevation-penumbra, 0 -1px 18px $elevation-ambient +$shadow-up-7 ?= 0 -4px 5px -2px $elevation-umbra, 0 -7px 10px 1px $elevation-penumbra, 0 -2px 16px 1px $elevation-ambient +$shadow-up-8 ?= 0 -5px 5px -3px $elevation-umbra, 0 -8px 10px 1px $elevation-penumbra, 0 -3px 14px 2px $elevation-ambient +$shadow-up-9 ?= 0 -5px 6px -3px $elevation-umbra, 0 -9px 12px 1px $elevation-penumbra, 0 -3px 16px 2px $elevation-ambient +$shadow-up-10 ?= 0 -6px 6px -3px $elevation-umbra, 0 -10px 14px 1px $elevation-penumbra, 0 -4px 18px 3px $elevation-ambient +$shadow-up-11 ?= 0 -6px 7px -4px $elevation-umbra, 0 -11px 15px 1px $elevation-penumbra, 0 -4px 20px 3px $elevation-ambient +$shadow-up-12 ?= 0 -7px 8px -4px $elevation-umbra, 0 -12px 17px 2px $elevation-penumbra, 0 -5px 22px 4px $elevation-ambient +$shadow-up-13 ?= 0 -7px 8px -4px $elevation-umbra, 0 -13px 19px 2px $elevation-penumbra, 0 -5px 24px 4px $elevation-ambient +$shadow-up-14 ?= 0 -7px 9px -4px $elevation-umbra, 0 -14px 21px 2px $elevation-penumbra, 0 -5px 26px 4px $elevation-ambient +$shadow-up-15 ?= 0 -8px 9px -5px $elevation-umbra, 0 -15px 22px 2px $elevation-penumbra, 0 -6px 28px 5px $elevation-ambient +$shadow-up-16 ?= 0 -8px 10px -5px $elevation-umbra, 0 -16px 24px 2px $elevation-penumbra, 0 -6px 30px 5px $elevation-ambient +$shadow-up-17 ?= 0 -8px 11px -5px $elevation-umbra, 0 -17px 26px 2px $elevation-penumbra, 0 -6px 32px 5px $elevation-ambient +$shadow-up-18 ?= 0 -9px 11px -5px $elevation-umbra, 0 -18px 28px 2px $elevation-penumbra, 0 -7px 34px 6px $elevation-ambient +$shadow-up-19 ?= 0 -9px 12px -6px $elevation-umbra, 0 -19px 29px 2px $elevation-penumbra, 0 -7px 36px 6px $elevation-ambient +$shadow-up-20 ?= 0 -10px 13px -6px $elevation-umbra, 0 -20px 31px 3px $elevation-penumbra, 0 -8px 38px 7px $elevation-ambient +$shadow-up-21 ?= 0 -10px 13px -6px $elevation-umbra, 0 -21px 33px 3px $elevation-penumbra, 0 -8px 40px 7px $elevation-ambient +$shadow-up-22 ?= 0 -10px 14px -6px $elevation-umbra, 0 -22px 35px 3px $elevation-penumbra, 0 -8px 42px 7px $elevation-ambient +$shadow-up-23 ?= 0 -11px 14px -7px $elevation-umbra, 0 -23px 36px 3px $elevation-penumbra, 0 -9px 44px 8px $elevation-ambient +$shadow-up-24 ?= 0 -11px 15px -7px $elevation-umbra, 0 -24px 38px 3px $elevation-penumbra, 0 -9px 46px 8px $elevation-ambient + + +$generic-border-radius ?= 4px +$generic-hover-transition ?= .3s cubic-bezier(.25, .8, .5, 1) +$typography-font-family ?= 'Roboto', '-apple-system', 'Helvetica Neue', Helvetica, Arial, sans-serif +$min-line-height ?= 1.12 + +$button-border-radius ?= 3px +$button-padding ?= 4px 16px +$button-dense-padding ?= .285em +$button-transition ?= $generic-hover-transition +$button-font-size ?= 14px +$button-line-height ?= 1.718em +$button-font-weight ?= 500 +$button-shadow ?= $shadow-2 +$button-shadow-active ?= $shadow-5 +$button-rounded-border-radius ?= 28px +$button-push-border-radius ?= 7px + +$chat-message-received-color ?= black +$chat-message-received-bg ?= $green-4 +$chat-message-sent-color ?= black +$chat-message-sent-bg ?= $grey-4 +$chat-message-avatar-size ?= 48px +$chat-message-border-radius ?= $generic-border-radius +$chat-message-distance ?= 8px +$chat-message-text-padding ?= 8px + +$item-base-color ?= $grey-5 + +$editor-border-color ?= $separator-color +$editor-content-padding ?= 10px +$editor-content-min-height ?= 10em +$editor-toolbar-padding ?= 4px +$editor-hr-color ?= $editor-border-color +$editor-button-gutter ?= 4px + +$fab-margin ?= 5px + +$table-transition ?= $generic-hover-transition +$table-border-radius ?= $generic-border-radius +$table-box-shadow ?= $shadow-2 + +$table-border-color ?= $separator-color +$table-hover-background ?= rgba(0, 0, 0, .03) +$table-selected-background ?= rgba(0, 0, 0, .06) + +$table-dark-border-color ?= $separator-dark-color +$table-dark-hover-background ?= rgba(255, 255, 255, .07) +$table-dark-selected-background ?= rgba(255, 255, 255, .1) + +$toolbar-min-height ?= 50px +$toolbar-padding ?= 0 12px +$toolbar-inset-size ?= 58px +$toolbar-title-font-size ?= 21px +$toolbar-title-font-weight ?= normal +$toolbar-title-letter-spacing ?= .01em +$toolbar-title-padding ?= 0 12px + +$layout-border ?= 1px solid $separator-color +$layout-shadow ?= 0 0 10px 2px rgba(0,0,0,0.2), 0 0px 10px rgba(0,0,0,0.24) + +$menu-background ?= white +$menu-box-shadow ?= $shadow-2 +$menu-max-width ?= 95vw + +$rating-grade-color ?= $yellow +$rating-shadow ?= 0 1px 3px rgba(0, 0, 0, .12), 0 1px 2px rgba(0, 0, 0, .24) + +$tooltip-color ?= #fafafa +$tooltip-background ?= $grey-7 +$tooltip-padding ?= 6px 10px +$tooltip-border-radius ?= $generic-border-radius +$tooltip-fontsize ?= 10px +$tooltip-mobile-padding ?= 8px 16px +$tooltip-mobile-fontsize ?= 14px + +$option-focus-transition ?= .22s cubic-bezier(0,0,.2,1) + +$input-font-size ?= 14px +$input-text-color ?= rgba(0,0,0,.87) +$input-label-color ?= rgba(0,0,0,.6) +$input-autofill-color ?= inherit + +$img-width ?= 100% +$img-background-repeat ?= no-repeat +$img-loading-font-size ?= 50px +$img-content-position ?= absolute +$img-content-padding ?= 16px +$img-content-color ?= white +$img-content-background ?= rgba(0, 0, 0, .47) diff --git a/examples/ws-fio-client/src/index.template.html b/examples/ws-fio-client/src/index.template.html new file mode 100644 index 0000000..c0e888f --- /dev/null +++ b/examples/ws-fio-client/src/index.template.html @@ -0,0 +1,22 @@ + + + + <%= htmlWebpackPlugin.options.productName %> + + + + + + + + + + + + + + + +
+ + diff --git a/examples/ws-fio-client/src/layouts/default.vue b/examples/ws-fio-client/src/layouts/default.vue new file mode 100644 index 0000000..f0176f9 --- /dev/null +++ b/examples/ws-fio-client/src/layouts/default.vue @@ -0,0 +1,38 @@ + + + + + diff --git a/examples/ws-fio-client/src/pages/Error404.vue b/examples/ws-fio-client/src/pages/Error404.vue new file mode 100644 index 0000000..cfaab5f --- /dev/null +++ b/examples/ws-fio-client/src/pages/Error404.vue @@ -0,0 +1,22 @@ + + + diff --git a/examples/ws-fio-client/src/pages/Index.vue b/examples/ws-fio-client/src/pages/Index.vue new file mode 100644 index 0000000..8e9c96f --- /dev/null +++ b/examples/ws-fio-client/src/pages/Index.vue @@ -0,0 +1,167 @@ + + + + diff --git a/examples/ws-fio-client/src/router/index.js b/examples/ws-fio-client/src/router/index.js new file mode 100644 index 0000000..46c6d54 --- /dev/null +++ b/examples/ws-fio-client/src/router/index.js @@ -0,0 +1,26 @@ +import Vue from 'vue' +import VueRouter from 'vue-router' + +import routes from './routes' + +Vue.use(VueRouter) + +/* + * If not building with SSR mode, you can + * directly export the Router instantiation + */ + +export default function (/* { store, ssrContext } */) { + const Router = new VueRouter({ + scrollBehavior: () => ({ x: 0, y: 0 }), + routes, + + // Leave these as is and change from quasar.conf.js instead! + // quasar.conf.js -> build -> vueRouterMode + // quasar.conf.js -> build -> publicPath + mode: process.env.VUE_ROUTER_MODE, + base: process.env.VUE_ROUTER_BASE + }) + + return Router +} diff --git a/examples/ws-fio-client/src/router/routes.js b/examples/ws-fio-client/src/router/routes.js new file mode 100644 index 0000000..24155d3 --- /dev/null +++ b/examples/ws-fio-client/src/router/routes.js @@ -0,0 +1,20 @@ + +const routes = [ + { + path: '/', + component: () => import('layouts/default.vue'), + children: [ + { path: '', component: () => import('pages/Index.vue') } + ] + } +] + +// Always leave this as last one +if (process.env.MODE !== 'ssr') { + routes.push({ + path: '*', + component: () => import('pages/Error404.vue') + }) +} + +export default routes diff --git a/examples/ws-fio-client/src/statics/app-logo-128x128.png b/examples/ws-fio-client/src/statics/app-logo-128x128.png new file mode 100644 index 0000000..0a3012a Binary files /dev/null and b/examples/ws-fio-client/src/statics/app-logo-128x128.png differ diff --git a/examples/ws-fio-client/src/statics/icons/apple-icon-120x120.png b/examples/ws-fio-client/src/statics/icons/apple-icon-120x120.png new file mode 100644 index 0000000..387499a Binary files /dev/null and b/examples/ws-fio-client/src/statics/icons/apple-icon-120x120.png differ diff --git a/examples/ws-fio-client/src/statics/icons/apple-icon-152x152.png b/examples/ws-fio-client/src/statics/icons/apple-icon-152x152.png new file mode 100644 index 0000000..5b76f91 Binary files /dev/null and b/examples/ws-fio-client/src/statics/icons/apple-icon-152x152.png differ diff --git a/examples/ws-fio-client/src/statics/icons/apple-icon-167x167.png b/examples/ws-fio-client/src/statics/icons/apple-icon-167x167.png new file mode 100644 index 0000000..0d743a6 Binary files /dev/null and b/examples/ws-fio-client/src/statics/icons/apple-icon-167x167.png differ diff --git a/examples/ws-fio-client/src/statics/icons/apple-icon-180x180.png b/examples/ws-fio-client/src/statics/icons/apple-icon-180x180.png new file mode 100644 index 0000000..f91040d Binary files /dev/null and b/examples/ws-fio-client/src/statics/icons/apple-icon-180x180.png differ diff --git a/examples/ws-fio-client/src/statics/icons/favicon-16x16.png b/examples/ws-fio-client/src/statics/icons/favicon-16x16.png new file mode 100644 index 0000000..20b3bb7 Binary files /dev/null and b/examples/ws-fio-client/src/statics/icons/favicon-16x16.png differ diff --git a/examples/ws-fio-client/src/statics/icons/favicon-32x32.png b/examples/ws-fio-client/src/statics/icons/favicon-32x32.png new file mode 100644 index 0000000..ed028e2 Binary files /dev/null and b/examples/ws-fio-client/src/statics/icons/favicon-32x32.png differ diff --git a/examples/ws-fio-client/src/statics/icons/favicon-96x96.png b/examples/ws-fio-client/src/statics/icons/favicon-96x96.png new file mode 100644 index 0000000..7c749e5 Binary files /dev/null and b/examples/ws-fio-client/src/statics/icons/favicon-96x96.png differ diff --git a/examples/ws-fio-client/src/statics/icons/favicon.ico b/examples/ws-fio-client/src/statics/icons/favicon.ico new file mode 100644 index 0000000..b385345 Binary files /dev/null and b/examples/ws-fio-client/src/statics/icons/favicon.ico differ diff --git a/examples/ws-fio-client/src/statics/icons/icon-128x128.png b/examples/ws-fio-client/src/statics/icons/icon-128x128.png new file mode 100644 index 0000000..0a3012a Binary files /dev/null and b/examples/ws-fio-client/src/statics/icons/icon-128x128.png differ diff --git a/examples/ws-fio-client/src/statics/icons/icon-192x192.png b/examples/ws-fio-client/src/statics/icons/icon-192x192.png new file mode 100644 index 0000000..144d474 Binary files /dev/null and b/examples/ws-fio-client/src/statics/icons/icon-192x192.png differ diff --git a/examples/ws-fio-client/src/statics/icons/icon-256x256.png b/examples/ws-fio-client/src/statics/icons/icon-256x256.png new file mode 100644 index 0000000..9ab309b Binary files /dev/null and b/examples/ws-fio-client/src/statics/icons/icon-256x256.png differ diff --git a/examples/ws-fio-client/src/statics/icons/icon-384x384.png b/examples/ws-fio-client/src/statics/icons/icon-384x384.png new file mode 100644 index 0000000..8bb494e Binary files /dev/null and b/examples/ws-fio-client/src/statics/icons/icon-384x384.png differ diff --git a/examples/ws-fio-client/src/statics/icons/icon-512x512.png b/examples/ws-fio-client/src/statics/icons/icon-512x512.png new file mode 100644 index 0000000..9b9ff56 Binary files /dev/null and b/examples/ws-fio-client/src/statics/icons/icon-512x512.png differ diff --git a/examples/ws-fio-client/src/statics/icons/ms-icon-144x144.png b/examples/ws-fio-client/src/statics/icons/ms-icon-144x144.png new file mode 100644 index 0000000..29fd72a Binary files /dev/null and b/examples/ws-fio-client/src/statics/icons/ms-icon-144x144.png differ diff --git a/examples/ws-fio-client/src/statics/icons/safari-pinned-tab.svg b/examples/ws-fio-client/src/statics/icons/safari-pinned-tab.svg new file mode 100644 index 0000000..1473927 --- /dev/null +++ b/examples/ws-fio-client/src/statics/icons/safari-pinned-tab.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/nodemon.json b/nodemon.json new file mode 100644 index 0000000..7044a6f --- /dev/null +++ b/nodemon.json @@ -0,0 +1,4 @@ +{ + "ignoreRoot": [".git","examples/ws-fio-client"], + "watch": ["node_modules/@uci/","node_modules/@uci-utils/","src/","index.js","examples/"] +} diff --git a/package.json b/package.json index 28719c3..c8c9bd1 100644 --- a/package.json +++ b/package.json @@ -1,18 +1,17 @@ { "name": "@uci/base", - "version": "0.1.25", + "version": "0.1.26", "description": "Multi type and transport JSON packet communication base class. Used in UCI extended classes", "main": "src/base", "scripts": { - "fiod": "UCI_ENV=dev ./node_modules/.bin/nodemon -r esm examples/four-in-one", + "fiod": "UCI_ENV=dev ./node_modules/.bin/nodemon -r esm --preserve-symlinks examples/four-in-one", "fio": "nodemon -r esm examples/four-in-one", "dy": "node -r esm examples/dynamic", "web": "UCI_DEV=true nodemon -r esm examples/web", "mqtt": "nodemon -r esm examples/mqtt", "ha-mqtt": "nodemon -r esm examples/ha-mqtt", - "testw": "mocha -r esm test/*.test.mjs --watch --recurse --watch-extensions mjs", - "test": "mocha -r esm test/*.test.mjs", - "testci": "istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -R spec --recursive && codecov || true" + "testw": "mocha -r esm test/*.test.mjs --watch --recurse ", + "test": "mocha -r esm test/*.test.mjs" }, "author": "David Kebler", "license": "MIT", @@ -40,7 +39,7 @@ "@uci-utils/bind-funcs": "^0.2.4", "@uci-utils/logger": "^0.0.15", "@uci/mqtt": "^0.1.12", - "@uci/socket": "^0.2.17", + "@uci/socket": "^0.2.19", "@uci/websocket": "^0.3.8", "await-to-js": "^2.1.1", "p-settle": "^3.1.0" diff --git a/src/base.js b/src/base.js index feb1505..97010d4 100644 --- a/src/base.js +++ b/src/base.js @@ -304,25 +304,35 @@ class Base extends EventEmitter { // add set of functions to class prop/space and then register with this addNamespace(space, type, trans) { + if (type !=='c' || type !=='s') { + trans = type + type = 's' } + trans = this._validateTransport(trans) if (trans) return this._namespaces[type + trans].unshift(space) else return this._namespaces[type].unshift(space) } // TODO confirm Object.assign will be ok as it is not a deep copy // one off add a command function or two to basic namespaces which is called before default - amendConsumerCommands(funcs, trans) { - if (trans) { - if (!this._c[trans]) this._c[trans] = {} - Object.assign(this._c[trans], funcs) + + amendCommands(funcs, trans, type) { + if (!trans && !type) type = 's' + if (trans ==='c' || trans ==='s') { + type = trans + trans = '' } - Object.assign(this._c, funcs) + trans = this._validateTransport(trans) + if (!this['_'+type+trans]) this['_'+type+trans] = {} + Object.assign(this['_'+type+trans], funcs) // trans is type here + log.debug({msg:'amended namespace', default_key:'_'+type+trans, functions:this['_'+type+trans]}) } + + amendConsumerCommands(funcs, trans) { + this.amendCommands(funcs,trans,'c') + } + amendSocketCommands(funcs, trans) { - if (trans) { - if (!this._s[trans]) this._s[trans] = {} - Object.assign(this._s[trans], funcs) - } - Object.assign(this._s, funcs) + this.amendCommands(funcs,trans) } // func should take and return a packet. if type @@ -338,21 +348,6 @@ class Base extends EventEmitter { this._packetHook('afterProcess', func,opts) } - _packetHook(hook,func,opts) { - log.debug({msg:'hooking a socket(s)', method:'_packetHook', line:334, hook:hook, function:func, options:opts}) - let {name,type,trans,all} = opts - if (name) this._socket[name][hook] = func - else { - log.debug({msg:'sockets available to hook', method:'_packetHook', line:338, sockets: Object.keys(this._socket)}) - for (let name of Object.keys(this._socket)) { - if (this._socket[name].type === type) this._socket[name][hook] = func - if (this._socket[name].transport === trans) this._socket[name][hook] = func - if (all) this._socket[name][hook] = func - if (this._socket[name][hook]) log.debug({msg:'hooked socket', method:'_packetHook', line:343, name:name, type:this._socket[name].type, trans:this._socket[name].transport}) - } - } - } - // A Big Hammer - use only if necessary - default with hooks should suffice // these three will pre-empt default processor to be called in ._packetProcess @@ -388,6 +383,24 @@ class Base extends EventEmitter { * */ + + + _packetHook(hook,func,opts) { + log.debug({msg:'hooking a socket(s)', method:'_packetHook', line:334, hook:hook, function:func, options:opts}) + let {name,type,trans,all} = opts + if (name) this._socket[name][hook] = func + else { + log.debug({msg:'sockets available to hook', method:'_packetHook', line:338, sockets: Object.keys(this._socket)}) + for (let name of Object.keys(this._socket)) { + if (this._socket[name].type === type) this._socket[name][hook] = func + if (this._socket[name].transport === trans) this._socket[name][hook] = func + if (all) this._socket[name][hook] = func + if (this._socket[name][hook]) log.debug({msg:'hooked socket', method:'_packetHook', line:343, name:name, type:this._socket[name].type, trans:this._socket[name].transport}) + } + } + } + + /* **********default packet processor for all sockets * this can be hooked or replaced all together @@ -436,6 +449,27 @@ class Base extends EventEmitter { } } + _validateTransport(trans, type='s') { + const valids = { + w:'w', + web:'w', + n:'n', + named:'n', + unix:'n', + pipe:'n', + t:'t', + tcp:'t', + net:'t', + network:'t', + m:'m', + mqtt:'m', + } + trans = valids[trans] || '' + if (type !== 'c' && trans ==='w') trans = '' + return trans + } + + _transport(name) { return this._socket[name].transport } //getter for socket transport @@ -457,7 +491,7 @@ class Base extends EventEmitter { return cmd_func } - // takes command and returns corresponding function in a hash + // takes command and returns corresponding function in a hash, recurisve walk _getCmdFunc(cmd, obj) { if (typeof cmd === 'string') { if (!obj) obj = this diff --git a/src/processing.js b/src/processing.js index 4db0920..af4dce2 100644 --- a/src/processing.js +++ b/src/processing.js @@ -45,16 +45,18 @@ const _process = { } } +// default name spaces const namespaces = { - s: ['_s'], - c: ['_c'], - cn: ['cn'], - ct: ['ct'], - sn: ['sn'], - st: ['st'], - cm: ['cm'], - sm: ['sm'], - sw: ['sw'], + s: ['_s'], // default command functions below + c: ['_c'], // default command functions below + cn: ['_cn'], + ct: ['_ct'], + cm: ['_cm'], + // no cw because websocket client runs in browser only + sn: ['_sn'], + st: ['_st'], + sm: ['_sm'], + sw: ['_sw'], } /* @@ -67,14 +69,14 @@ const defaultCmds ={ s:{ echo: async packet => { packet.processed = true - packet.info = 'default socket echo' + packet.msg = '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 - packet.info = 'this is the base default ack, superceed in your extended class' + packet.msg = 'this is the base default ack, superceed in your extended class' return packet } },