Introvertuous / react-native-mqtt

Mqtt client for react native.
MIT License
156 stars 31 forks source link

AMQJS0016E Invalid MQTT message type 0. #7

Closed ngocdb closed 7 years ago

ngocdb commented 7 years ago

I am using your module in my react native projects. In one app, everything is ok on the emulator. But in another app, I always get the error "AMQJS0016E Invalid MQTT message type 0." on the emulator.

Object {invocationContext: undefined, errorCode: 16, errorMessage: "AMQJS0016E Invalid MQTT message type 0."}

I can say the Mqtt codes are very similar if not same between 2 apps.

So how can I debug the issue, please help. P/S: not sure if it comes from AsyncStorage ?, your module will use different key for different apps in AsyncStorage ?, or how you build it currently ?

ngocdb commented 7 years ago

Actually, the one is working on a older version of react native: "react": "~15.4.0-rc.4", "react-native": "0.40.0", "react-native-elements": "^0.9.2", "react-native-storage": "^0.1.4", "react-native-vector-icons": "^4.0.0", "react_native_mqtt": "^1.1.4" And it seems doesn't work any more with new versions: "react": "16.0.0-alpha.12", "react-native": "0.46.4", "react-native-elements": "^0.15.0", "react-native-storage": "^0.2.2", "react-native-vector-icons": "^4.2.0", "react_native_mqtt": "^1.1.6" Of course if you have any suggestion, please tell me...

ngocdb commented 7 years ago

I tested up to the 0.45.0 version

... "react": "16.0.0-alpha.12", "react-native": "0.45.0", ...

and it still runs well.

But it fails with the 0.46.4 version. Check the release notes, I see there is a change with websocket in the latest version.

Added Cookie Header to XML and Websocket request (047961f)

Not sure how this thing affect the mqtt connect ?

Introvertuous commented 7 years ago

Apologies in advance for the delay in response.

I am not able to reproduce this error in the current version of react native (v0.48.1). I added a runnable example with instructions today.

Please feel free to re-open if this is still an issue.