-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot connect to broker #5
Comments
Hi Matt. That's odd - you're hitting https://github.com/rh389/react-native-paho-mqtt/blob/master/src/ClientImplementation.js#L635 which means the client has received data through the websocket but it's not a valid MQTT packet. You might try adding |
Hi @rh389 and thanks for the quick answer. I did as you suggested and here is the output:
|
You could try discarding the empty frames by modifying the source like this: 5edc608 If that works for you I'll release it (can't do any harm). If it doesn't, then that suggests to me that there's something going wrong with the underlying websocket communication in your case. |
I tried but it doesn't work, I also tried to add a new case 0 to the switch, it seems I get time outs
Will have a look at network/ws library |
Also, I tried to use the node library mqtt.js and I can connect, publish and receive messages correctly to and from the same broker |
It makes sense that it'd timeout if the packet we're discarding is supposed to be the I think the most likely explanation is an issue with your RN |
The raw WS API on the test server seems to work very well, I connect, send and get back the message |
I'm at a loss then I'm afraid - if you have a sample app you could point to I'll try it out. |
let me build a new project with a single view that uses the mqtt client, will post here the link when I'll be done :) |
Well, I can reproduce what you're seeing but it's slightly baffling. The |
This is probably what my own mosquitto broker is returning as well |
Ha - I bet it's this, fixed in RN yesterday: facebook/react-native#15046 Which means it was broken by facebook/react-native@93a1d59, so it should work in RN <=0.45, but is broken in RN 0.46 and 0.47. Unfortunately there's nothing this library can do to compensate for that - it's very much reliant on binary websockets so I think you'll either have to either downgrade RN or wait for 0.48. |
@rh389 thanks a lot for the time you spent digging into this, we have downgraded and it works now 👍 |
No worries - good luck with your project (and thanks for the bug report) |
FYI - the fix for this landed in 0.47-rc.5, so it will be in 0.47 final. |
same issue but i want to connect with iot-aws serverless that deploy on amazon when ever i connect it throw a connectionLost error
|
Hi, apparently it seems I cannot connect to any broker from my android emulator, every time I try to connect I get this error:
I don't really get what's wrong, I just tried the given example with both the eclipse broker and my own broker but the result is the same. Any help would be very very appreciated
The text was updated successfully, but these errors were encountered: