Open ghost opened 4 years ago
same question
Same, nothing happens on client.connect(...), no error, logs or anything, doesn't matter what options I try
Any solution on this ?
Works well on iOS, nothing at all on Android.
same question
Works well on iOS, nothing at all on Android.
Any solution on this now?
Change the the with tcp protocal
const client = new Mqtt.Client('tcp://test.mosquitto.org:1883');
Change the the with tcp protocal
const client = new Mqtt.Client('tcp://test.mosquitto.org:1883');
did not work for me, when using 'tcp' it returns undefined error
in the image the first log is using the 'mqtt' and in the second the 'tcp'
I had same issue.
From Eclipse Paho's document ( https://www.eclipse.org/paho/files/javadoc/org/eclipse/paho/client/mqttv3/MqttConnectOptions.html#setUserName-java.lang.String- ) :
public void setUserName(java.lang.String userName) Sets the user name to use for the connection. Throws: java.lang.IllegalArgumentException - if the user name is blank or only contains whitespace characters.
So, I think below implementation of this library is a bit wrong:
https://github.com/davesters/rn-native-mqtt/blob/master/android/src/main/java/com/davesters/reactnative/mqtt/MqttClient.java#L66 https://github.com/davesters/rn-native-mqtt/blob/master/src/index.ts#L24
username
must be specified. Can't be omitted.
i changed the protocal and added the usename and is worked.
const client = new Mqtt.Client('tcp://test.mosquitto.org:1883');
and
client.connect({clientId: 'CLIENT_ID_0012656562645', username: 'USERNAME_0012656562645'}, err => {console.log(err)});
@imetric @clvs7-gh thanks a lot..
Hi, i'm trying to get simple test of this and i'm get error when trying to connect to server, i test my own mqtt server and free public server like mosquitto, but the result its same.
Im testing this on android
I'm start my project with
npx react-native init MqttSample --template react-native-template-typescript
then i'm install the lib with:
npm install react-native-native-mqtt --save
then i run
react-native link react-native-native-mqtt
And my simple code is:
Simply, i'm test with and without typescript templates and the result its same.