ngx-mqtt 项目使用教程

ngx-mqtt 项目使用教程

ngx-mqttThis library isn't just a wrapper around MQTT.js for angular. It uses observables and takes care of subscription handling and message routing.项目地址:https://gitcode.com/gh_mirrors/ng/ngx-mqtt

1. 项目的目录结构及介绍

ngx-mqtt 是一个用于 Angular 项目的 MQTT 客户端库,它不仅是一个 MQTT.js 的包装器,还提供了 observables 和订阅管理等功能。以下是 ngx-mqtt 项目的目录结构及其介绍:

ngx-mqtt/
├── dist/
│   ├── bundles/
│   ├── esm2015/
│   ├── esm5/
│   ├── fesm2015/
│   ├── fesm5/
│   ├── lib/
│   └── ngx-mqtt.d.ts
├── src/
│   ├── lib/
│   │   ├── client/
│   │   ├── message/
│   │   ├── observable/
│   │   ├── plugin/
│   │   ├── shared/
│   │   └── util/
│   ├── public_api.ts
│   └── test.ts
├── .editorconfig
├── .gitignore
├── .npmignore
├── .travis.yml
├── CHANGELOG.md
├── LICENSE
├── README.md
├── angular.json
├── package.json
├── tsconfig.json
├── tslint.json
└── yarn.lock

目录结构介绍

  • dist/: 编译后的文件目录,包含不同模块格式的输出。
  • src/: 源代码目录,包含库的主要实现和测试文件。
    • lib/: 库的核心实现,包括客户端、消息处理、 observables 等模块。
    • public_api.ts: 库的公共 API 入口。
    • test.ts: 测试配置文件。
  • .editorconfig, .gitignore, .npmignore, .travis.yml: 项目配置文件。
  • CHANGELOG.md, LICENSE, README.md: 项目文档。
  • angular.json, package.json, tsconfig.json, tslint.json, yarn.lock: 项目构建和依赖管理文件。

2. 项目的启动文件介绍

ngx-mqtt 项目的启动文件主要是 public_api.ts,它是库的入口文件,导出了所有公共 API。

/* src/public_api.ts */

/*
 * Public API Surface of ngx-mqtt
 */

export * from './lib/client';
export * from './lib/message';
export * from './lib/observable';
export * from './lib/plugin';
export * from './lib/shared';
export * from './lib/util';

启动文件介绍

  • public_api.ts: 导出了库的所有模块,包括客户端、消息处理、 observables 等,使得用户可以方便地引入和使用这些模块。

3. 项目的配置文件介绍

ngx-mqtt 项目的配置文件主要包括 angular.json, package.json, tsconfig.json, 和 tslint.json

angular.json

angular.json 是 Angular 项目的配置文件,包含了项目的构建和开发配置。

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "ngx-mqtt": {
      "projectType": "library",
      "root": "projects/ngx-mqtt",
      "sourceRoot": "projects/ngx-mqtt/src",
      "prefix": "lib",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-ng-packagr:build",
          "options": {
            "tsConfig": "projects/ngx-mqtt/tsconfig.lib.json",
            "project": "projects/ngx-mqtt/ng-package.json"
          },
          "configurations": {
            "production": {
              "tsConfig": "projects/ngx-mqtt/tsconfig.lib.prod.json"
            }
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "projects/ngx-mqtt/src/test.ts",
            "tsConfig": "projects/ng

ngx-mqttThis library isn't just a wrapper around MQTT.js for angular. It uses observables and takes care of subscription handling and message routing.项目地址:https://gitcode.com/gh_mirrors/ng/ngx-mqtt

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

蒙曼为

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值