UNPKG

@robot.com/better-mqtt

Version:

A modern, TypeScript-first MQTT client library that provides a better developer experience with async iterators, shared subscriptions, and React hooks. Better MQTT is a wrapper around the excellent [mqtt.js](https://github.com/mqttjs/MQTT.js) library, enh

19 lines (16 loc) 757 B
import * as react_jsx_runtime from 'react/jsx-runtime'; import { ErrorWithReasonCode } from 'mqtt'; import { ReactNode } from 'react'; import { BetterMQTT } from './index.js'; import 'ee-ts'; declare function BetterMQTTProvider(props: { children: ReactNode; client: BetterMQTT; }): react_jsx_runtime.JSX.Element; declare function useMQTT(): BetterMQTT; declare function useMQTTStatus(): string; declare function useMQTTSubscription<T>(topic: string, parser: (message: Buffer) => T, onMessage: (message: T) => void, opts?: { enabled?: boolean; }): void; declare function useMQTTError(onError: (error: Error) => void): Error | ErrorWithReasonCode | null; export { BetterMQTTProvider, useMQTT, useMQTTError, useMQTTStatus, useMQTTSubscription };