{"_id":"@agilatech/lynxari-wsfeed-application","_rev":"2-606cc9d7886a52192face80b4465666f","name":"@agilatech/lynxari-wsfeed-application","dist-tags":{"latest":"1.0.0"},"versions":{"0.6.0":{"name":"@agilatech/lynxari-wsfeed-application","version":"0.6.0","description":"Lynxari Server App for streaming sensor data on a websocket server","main":"loader.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"ssh://scott@209.200.216.6:22125/volume1/git_repos/lynxari-wsfeed-application"},"dependencies":{"websocket":"*"},"keywords":["websockets"],"author":{"name":"scotty","email":"scott@agilatech.com","url":"http://agilatech.com"},"license":"SEE LICENSE IN LICENSE","gitHead":"9061c7da5e6629f2d6305c52d6c0ba1c2752fde6","_id":"@agilatech/lynxari-wsfeed-application@0.6.0","_npmVersion":"6.0.0","_nodeVersion":"6.2.2","_npmUser":{"name":"scotty","email":"scott@agilatech.com"},"dist":{"integrity":"sha512-FFHnNn8vaIW5dqC5fEXy3p4uz8/8J9v1dfMF5yzLRjnyNJhIgpSfd/o/+S2WVK55A1pVdZY4nREVeEp9+BqGlA==","shasum":"8c7f1daa0651aa37f0ac7d15c62e4cda258f74ce","tarball":"https://registry.npmjs.org/@agilatech/lynxari-wsfeed-application/-/lynxari-wsfeed-application-0.6.0.tgz","fileCount":7,"unpackedSize":9860,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbJ9e7CRA9TVsSAnZWagAAhTIP/1NZf+EWZHpfb3dAxNOs\nxZsOnVCMqh2R3ANueZO1Yob8B1mzp25VwtvMNsDAGQ/6c6QXqCWGMPGrjuYX\nJL3GkjzZ6zbaMHuMrXtv/ijQNrN1jRJ3C+kdShtsImSb0NtqAyH1okZUu1QV\nbb4vKfjv27t9kr2ZSc/+1cY9GT5PbZ543fq7N0zdB8v6moeTTp+3DE6zUC1v\nFYD38lhnIo38VjA6NVCTRTMlDD7CZF/+Np1buOEQRppQwYvSuKNT44lKpgRq\nqf5fq96BYaaXubF5clImHhnlGl97S85pVzpaSZzx68SdDy5yiv8S91KTr3b/\nNwprx0IeQfpDojsrTwpKTqxJXhTCjRt8MZfVqCXo2fhekMp1HtLfVYx0ncyW\np5iyyqbZQ2UMb7ms0J120QDbSc4WwTLOB0bazNeyliBrGtsvZM04cULxdX8S\nqBzBlbxIFgS37MPEG4vZrOEs4ACNNXBf7Au0+G0Qm+3cL1Fy7/s1FR/q1N4N\nft/cOxbYAGwRNql7GSMA+uz7DbcIir8F6xTjYhG9p3p+VNHALX4fIZ6KjRQK\noxxVTRRl4tVCgI8/kWqbSCzlw7ZL8wM8nUkZxOS6algaHLB665LMewMStqjq\nyS/KVQcAfO53wYMguYv76YD7FP/e2ARa0Csq81QrAFjVopENAFsDdbn9W8A0\nqz8d\r\n=HrYp\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC+twRr3BuUT3BzCjwWN3pdLbxZOX0EGMVJjd/x2bCbeAiEAgdrdu/tt/MNMS78Oncrbmn+FTjgaVVHTpclUkC6ydyo="}]},"maintainers":[{"name":"scotty","email":"scott@agilatech.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/lynxari-wsfeed-application_0.6.0_1529337786515_0.22824110714199364"},"_hasShrinkwrap":false},"1.0.0":{"name":"@agilatech/lynxari-wsfeed-application","version":"1.0.0","description":"Lynxari Server App for streaming sensor data on a websocket server","main":"loader.js","scripts":{"test":"echo \"Error: runs only within Lynxari\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/Agilatech/lynxari-wsfeed-application.git"},"dependencies":{"websocket":"*"},"keywords":["websockets","websocket","agilatech","lynxari"],"author":{"name":"scotty","email":"scott@agilatech.com","url":"http://agilatech.com"},"license":"MIT","gitHead":"77d3d2021c0f3a6fd19abb8a2f2991f167892821","bugs":{"url":"https://github.com/Agilatech/lynxari-wsfeed-application/issues"},"homepage":"https://github.com/Agilatech/lynxari-wsfeed-application#readme","_id":"@agilatech/lynxari-wsfeed-application@1.0.0","_npmVersion":"6.5.0","_nodeVersion":"10.15.0","_npmUser":{"name":"scotty","email":"scott@agilatech.com"},"dist":{"integrity":"sha512-R0SZ69zFL+/H+kFa8kLH/EFF27ce6KeW4tR6/su+HpCiQQbHXHGkUNMcw1De1Zv5VEww7lWFATq2Dugz5xHwxw==","shasum":"5a562f1d44e606e339db353771d200cd2eeaf6be","tarball":"https://registry.npmjs.org/@agilatech/lynxari-wsfeed-application/-/lynxari-wsfeed-application-1.0.0.tgz","fileCount":8,"unpackedSize":16806,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcUMoICRA9TVsSAnZWagAA8P8QAI1EVDxtv3lW6RFMKnOX\nLswcThfp1pu3/Xtpyw/pk09+duVx44HVoifGhUsaMu9KYa9T9YxXgEw1KL/j\n6rPMFde51W/odVo4r0MaHZvvwIeAGrsxVq/UP6owPODE+yD6V05on8L+TN1v\nySZU+lrgAdrpdyfw63xoeepZk/c1dPIu5bOHh8lanLKPVqHEDDEyIIxKTRVk\nwWOK62HAdwAcgKplljjWqO22/Enrcrpom8zZppNe2N3FSV0mYDxcpZojZXWy\nmhlUyYnJe30ZmkCq2D2wSptKnZ5W+0RLURsWl1HPhFY/MDnlk+YYd6mtnj3O\nzAq0lRbYg+6Aq2rqLGHYs86QS/1yezvpbZSv8g6K9jlFicW3koP5njzH7naX\nNUFRExbl6VNa87OMflD3MbgmmE9ilxwXFYCexuGWcswJ5SE8pyslilmyniwC\nZ7V4ojfiUe/p2eVC2owwYsLXoD7qecnIPojh1oOw77lOQO9GUmUBZMXAJdb/\nyULrMdFScsRmCV9Cdjm5mrVsP3RcYRK+goak5BfysaOGXthi9kCnfvjbooX4\nOpzncjAsbbfsjpblVeDqZFKx8h9T1Y/YnjJbYfBBEoOiEE1qnxTIwtmmqifg\nySe3OodPbe5146a/+i76IFhoD4wh/0i4IGKK8bN0lTMdPDi8A/TWWrFy14Wu\nQUAO\r\n=HlSX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD1Uda2VEGC0hRZ6XDESlAGKyvpysHQLH9RB4lITgUJGwIhAOqisne2NacFM27qr1I2N/ej8+dmQUgamGxtn1tnsICw"}]},"maintainers":[{"name":"scotty","email":"scott@agilatech.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/lynxari-wsfeed-application_1.0.0_1548798472077_0.10953422362796927"},"_hasShrinkwrap":false}},"time":{"created":"2018-06-18T16:03:06.328Z","0.6.0":"2018-06-18T16:03:06.574Z","modified":"2022-04-04T11:57:16.283Z","1.0.0":"2019-01-29T21:47:52.175Z"},"maintainers":[{"name":"scotty","email":"scott@agilatech.com"}],"description":"Lynxari Server App for streaming sensor data on a websocket server","keywords":["websockets","websocket","agilatech","lynxari"],"repository":{"type":"git","url":"git+https://github.com/Agilatech/lynxari-wsfeed-application.git"},"author":{"name":"scotty","email":"scott@agilatech.com","url":"http://agilatech.com"},"license":"MIT","readme":"![Lynxari IoT Platform](https://agilatech.com/images/lynxari/lynxari200x60.png) **IoT Platform**\n## Lynxari Websocket Feed Application\n\n### Install\n```\n$> npm install @agilatech/lynxari-wsfeed-application\n```\nInstall in the same directory in which lynxari is installed. Create a config.json file to suit.\n\n\n### Purpose\nThe purpose of this application is to feed data from devices to a websocket. Remote clients which are allowed by the app configuration may connect to the websocket to receive the data feed. This provides a more direct method to get data while at the same time having such data data automatically pushed to the client.\n\n\n### Usage\nThis application runs on the [Agilatech®](https://agilatech.com) Lynxari IoT platform.  As such, it is not applicable for other environments.\n\nTo use it with Lynxari, simply insert its object definition as an element in the apps array in the _applist.json_ file. On startup, the Lynxari server reads _applist.json_ and starts all applications found there.\n\nA _config.json_ configuration file must be present in the module's main directory. For this module, that will be within the Lynxari home directory in _node\\_modules/@agilatech/lynxari-wsfeed-application/config.json_\n\n\n### Configuration\nThe _config.json_ file contains objects which define the security parameters, what hosts are allowed to connect, and the devices which are monitored.  A sample config file is provided to give an example.\n\nFirst, the security object:\n1. **autoAccept** : **true** | **false** Boolean setting whether or not to check validity of self-signed certificates. Always set this to false except for development testing.\n2. **usePlatformTLS** : **true** | **false** Boolean setting whether or not to use the Lynxari TLS security, which includes the platform certificates. If set to true, then the initial connection will be via https, and the websocket will use the wss protocol.\n\nNext is an array of allowed clients. If the hostname or IP address is not a member of the array, then it's request will be ignored. Only those clients whose domain or IP appear in the **allow** array will be served.\n\nThe devices array contains device definitions which will be served to Websocket receivers. \n1. **name** : The name of the device -- this is used to query the platform for a connected device of the name. The query will fail if the name is not found.\n2. **port** : The unix port on the local host on which to listen for requests. By convention, ports in the 8000 range are typically used, but this can be any valid port number up to 65535.\n3. **values** : An array of device values to served. A message will be sent for every new value for every device to every requestor.\n\nNote that each device starts its own server, and listens on the given port. Devices may be duplicated with different ports.\n\nThere is no limit to the number of device objects which may appear in the **devices** array. The config.json file must be valid JSON.\n\nA sample config file:\n```\n{\n    \"security\": {\n        \"autoAccept\": false,\n        \"usePlatformTLS\": false\n    },\n    \"allow\": [\n        \"192.168.44.100\",\n        \"192.168.44.155\",\n        \"agilatech.com\",\n        \"10.0.248.*\"\n    ],\n    \"devices\": [\n        {\n            \"name\": \"VL6180\",\n            \"port\": 8082,\n            \"values\": [\"range\"]\n        },\n        {\n            \"name\": \"MPU9250\",\n            \"port\": 8084,\n            \"values\": [\"accelx\", \"accely\", \"accelz\"]\n        }\n    ]\n}\n```\n\n### Client Websocket connection\nA typical minimum client-side program might look like this:\n```\n<script>\n    const wss = new WebSocket(`wss://localhost:8082`, 'wsfeed-protocol');\n\n    wss.onmessage = function(evt) {\n        console.log(`Received new wss data ${evt.data}`);\n        const data = JSON.parse(evt.data);\n        message.innerHTML = data.value;\n    }\n</script>    \n```\nNote that the Lynxari wsfeed app uses the protocol 'wsfeed-protocol'. This protocol string must be present in the websocket constructor.  If missing or different, the connection will be refused by the server.\n\n\n### Certificate Authority trust issues\nUnless the secure certificate loaded into Lynxari is signed by an industry trusted certificate authority contained in the Web broswer, a client-side Web program connecting to a wss websocket will likely fail.  To overcome this error, the signing authority certificate must be loaded into the browser and trusted. Different browsers have different mechanisms for doing this, and the top three are covered here:\n\n#### Safari\nmacOS Utilities contains a Keychain Access program which handles all the certificates for the operating system. Safari uses this system-wide access rather than loading certificates into the browswer itself.\nTo load an Certificate Authority certificate in the Keychain Access:\n1. Launch the Keychain Access program from the Applications->Utilities folder \n2. Click on the 'System' Keychain in the upper-left sidebar.\n3. From the menu, select File->Import Items\n4. In the file dropdown, navigate to your Certificate Authority certificate and click 'Oopen'\n5. Since you are modifying the system keychain, the program will ask for your password.\n6. Provide your password and click 'Modify Keychain'.\n7. The CA certificate will now be saved in the system, but it is not trusted. (notice the red X)\n8. Right-click on the CA entry with the red X, and select 'Get Info' from the drop-down.\n9. In the pop-up window, there will be a collapsed list entitled 'Trust'. Click its arrow to expand.\n10. Select as many of the items to turst, but at a minimum, select the option 'Always Trust' for Secure Sockets Layet (SSL).\n11. Close the window, and you will again be asked for your password due to making changes to the System Certificate Trust Settings.\n12. Provide your password and click 'Update Settings'. The CA certificate entry should now show a blue X next to it.\n13. Safari will now trust the CA certificate, and thereby allow the server certificate to be used for TLS https communications.\n \n#### Google Chrome\nOn a Mac, Google Chrome accesses the system keychain, so the above instructions for Safari also apply when running Chrome on macOS.\nOn other systems:\n1. Open Preferences\n2. Scroll to bottom, expand 'Advanced'\n3. In 'Privacy and Security' section, find 'Manage Certificates', and click on 'Manage HTTPS/SSL certificates and settings'.\n4. Follow the instructions for your OS.\n\n#### Firefox\n1. Open Preferences\n2. Select 'Privacy & Security' on the sidebar\n3. Scoll down to bottom, to the 'Certificates' section\n4. Click the 'View Certificates' button -- this will bring up a 'Certificate Manager' dialog box\n5. Select 'Authorities' tab\n6. Press 'Import' buttom at the bottom of the dialog box\n7. Navigate the filesystem dialog to your signing authority CA certificate and click 'Open'\n8. A dialog box asks how this certificate shall be trusted, select 'Trust this CA to identify websites.\" and select 'OK'\n9. Now select 'OK' to close the 'Certificate Manager' dialog box.\n\n\n### Copyright\nCopyright © 2018-2019 [Agilatech®](https://agilatech.com). All Rights Reserved.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","readmeFilename":"README.md","homepage":"https://github.com/Agilatech/lynxari-wsfeed-application#readme","bugs":{"url":"https://github.com/Agilatech/lynxari-wsfeed-application/issues"}}