npm.io
1.0.5 • Published 2 years ago

@rn-toolkit/mqtt

Licence
MIT
Version
1.0.5
Deps
2
Size
27 kB
Vulns
0
Weekly
0

@rn-toolkit/mqtt

Base on MQTT.js

npm i @rn-toolkit/mqtt

#or

yarn add @rn-toolkit/mqtt

Use in React/ReactNative


  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

Keywords