Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

draft: fix: update imports for usage of precompiled mqtt #71

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Connector.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useState, useMemo, useRef } from 'react';

import { connect, MqttClient } from 'mqtt';
import { connect, MqttClient } from 'precompiled-mqtt';

import MqttContext from './Context';
import { Error, ConnectorProps, IMqttContext } from './types';
Expand Down
2 changes: 1 addition & 1 deletion lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MqttClient, IClientOptions } from 'mqtt';
import { MqttClient, IClientOptions } from 'precompiled-mqtt';

export interface Error {
name: string;
Expand Down
7 changes: 3 additions & 4 deletions lib/useSubscription.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useContext, useEffect, useCallback, useState } from 'react';

import { IClientSubscribeOptions } from 'mqtt';
import { matches } from 'mqtt-pattern';
import { IClientSubscribeOptions } from 'precompiled-mqtt';

import MqttContext from './Context';
import { IMqttContext as Context, IUseSubscription, IMessage } from './types';
Expand All @@ -10,9 +10,8 @@ export default function useSubscription(
topic: string | string[],
options: IClientSubscribeOptions = {} as IClientSubscribeOptions,
): IUseSubscription {
const { client, connectionStatus, parserMethod } = useContext<Context>(
MqttContext,
);
const { client, connectionStatus, parserMethod } =
useContext<Context>(MqttContext);

const [message, setMessage] = useState<IMessage | undefined>(undefined);

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@
"react-dom": ">= 18.1.0"
},
"dependencies": {
"mqtt": "4.3.7",
"mqtt-pattern": "^1.2.0"
"mqtt-pattern": "^2.0.0",
"precompiled-mqtt": "^4.3.14-beta"
},
"config": {
"commitizen": {
Expand Down
Loading