GithubHelp home page GithubHelp logo

firefightingcollector's Introduction

透传采集服务端程序

项目说明

适配透传采集器

环境配置

1. 安装 Node.jsnpm

如果你的机器上还没有 Node.jsnpm , 安装它们 。 该工程需要 node v10.x.x 或更高版本以及 npm 6.x.x 或更高版本。 要检查你正在使用的版本,请在终端窗口中运行

node -v

npm -v

本项目依赖Node包管理工具(npm)管理项目所需的第三方库文件



3. 安装依赖包

当基本环境确认无误后,在终端命令行中进入本项目根目录,并输入以下命令,使用npm来安装package.json中列出的依赖包

npm install

输入该指令后工程目录下应当会出现新的依赖文件夹node_modules,注意安装过程中应当不出现npm ERR!信息

提示:
  由于npm原资源地址由于网络原因可能出现下载缓慢甚至出错的情况,建议修改npm下载地址至淘宝的镜像下载源

npm config set registry https://registry.npm.taobao.org

之后输入以下命令确认修改是否成功

npm info underscore

4. 可能问题

如果通过npm镜像安装依赖失败,可尝试用国内镜像

npm install -g cnpm --registry=https://registry.npm.taobao.org

如果遇到 未能加载 Visual C++ 组件“VCBuild.exe”, 需要安装构建工具

npm install --global --production windows-build-tools

5. 使用注意

注意:

  1. 采集时 a_item.code 即为 设备addr
  2. 上报数据, 需要配置一个key为[ind]的点信息, 对应a_item_data.indication字段 {"id": 1, ind: 2}

启动命令: (其中10对应a_collector中的collectorId) node src/index.js 10

当前为server模式, 运行后监听host:post(src/conf/sysConfig.js中对应配置)等待client连接 test/testDeviceClient.js 为模拟的client

运行时:

  1. 读取 db.a_item, 获取所有需要采集的设备
  2. 监听数据
  3. 解析并更新db

6. 测试脚本

7. 代码保护

  1. 安装混淆工具 javascript-obfuscator npm install -D javascript-obfuscator
  2. 安装编码工具 bytenode npm install -D bytenode
  3. 编写编译脚本 build.js
  4. 发布时执行命令 node build.js ,会创建 dist 目录, 包含所有编译好的代码
  5. 启动服务 bytenode dist/index.jsc 0

firefightingcollector's People

Watchers

James Cloos avatar sam.wang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.