tuanpmt/react-native-mqtt

TypeError: Cannot read property 'createClient' of undefined

Closed this issue · 15 comments

I had no problem installing the module. In index.android.js I have the following:

var mqtt = require('react-native-mqtt');
/* create mqtt client */
mqtt.createClient({ ...

The error I get is this:

TypeError: Cannot read property 'createClient' of undefined

Thanks for your help.

same problem here

same here.. !!!!
does anyone know if this was already resolved in some other issue ?
or if there is other module that we can use to get it to work with IOS ??

Anyone solve this issue?

Same here! Any solutions?

owant commented

???

pewh commented
  • 1

I am also facing the same issue for the last couple of days.

{ [TypeError: undefined is not an object (evaluating 'Mqtt.createClient')]
line: 51749,
column: 43,
sourceURL: 'http://localhost:8081/index.bundle?platform=android&dev=true&minify=false' }
adb logcat

is this any solution for it??????
same error showing

Did ya'll run this react-native link react-native-mqtt after installing the package?
This worked for me. I had forgotten to link the native modules.

Didn't know about this linking business. Will try it out. Thanks.
Doc: https://facebook.github.io/react-native/docs/linking-libraries-ios

Hello,

I experience the same issue. I used the expo cli to make the boilerplate code. I've tried doing the react-native link command and the error still persist. Do you have any thoughts on the issue?

I am also facing the same issue for the last couple of days.

{ [TypeError: undefined is not an object (evaluating 'Mqtt.createClient')]
line: 51749,
column: 43,
sourceURL: 'http://localhost:8081/index.bundle?platform=android&dev=true&minify=false' }
adb logcat

I have encountered the same problem with you. Can you solve it? How is it solved?thank you

I did not work on this after that. Surprised it's still not resolved.

I just noticed this project has not been updated for long. They recommend to use https://github.com/eclipse/paho.mqtt.javascript

在那之后我没有做这个。感到惊讶的是它仍然没有解决。

我只是注意到这个项目没有更新很长时间。他们建议使用https://github.com/eclipse/paho.mqtt.javascript

thank you, Does this support react-native?

I did not work on this after that. Surprised it's still not resolved.

I just noticed this project has not been updated for long. They recommend to use https://github.com/eclipse/paho.mqtt.javascript

I found my problem, I did not register in MainApplication.java, before I use react-native-beacons-manager to automatically scan to the package, I thought this will be automatically scanned, the result is not the case, add this sentence Just "packages.add(new RCTMqttPackage());"