# @rn-toolkit/mqtt

> Support MQTT in ReactNative, Base on MQTT.js

Latest version **1.0.5** (published 2023-12-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @rn-toolkit/mqtt
pnpm add @rn-toolkit/mqtt
yarn add @rn-toolkit/mqtt
bun add @rn-toolkit/mqtt
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2023-12-29 |
| First published | 2023-05-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 26.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | @rn-toolkit |
| Maintainers | hiroenzo, manweill |
| Keywords | react-native, react, mqtt |

## Links

- npm: https://www.npmjs.com/package/@rn-toolkit/mqtt
- Homepage: https://github.com/orgs/rn-toolkit/mqtt-toolkit
- npm.io page: https://npm.io/package/@rn-toolkit/mqtt

## Dependencies (2)

- [mqtt](https://npm.io/package/mqtt.md) ^4.3.7
- [mqtt-pattern](https://npm.io/package/mqtt-pattern.md) ^2.1.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2023-12-29
- 1.0.4 — 2023-07-14
- 1.0.3 — 2023-05-24

## README

# @rn-toolkit/mqtt
Base on [MQTT.js](https://github.com/mqttjs/MQTT.js)

```bash
npm i @rn-toolkit/mqtt

#or

yarn add @rn-toolkit/mqtt
```

#### Use in React/ReactNative
```js

  useEffect(() => {
    const destroy = initMqtt(
      [
        {
          name: '/msg/+',
          cb: data => {
            console.log('/msg/+', data);
          },
        },
        {
          name: '/msg/1',
          cb: data => {
            console.log('/msg/1', data);
          },
        },
      ],
      {
        host: 'your host',
        port: 8083,
      },
    );
    return () => destroy();
  }, []);
```

#### TODO
- [ ] support [MQTTPattern](https://github.com/RangerMauve/mqtt-pattern)

---
_Source: https://npm.io/package/@rn-toolkit/mqtt · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
