-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
'close' event triggered soon after the 'connect' event gets triggered #570
Comments
I have a similar issue. It was working about 4 days ago, and now it does not. Here is what happened on our side :
|
Is this a regression between v2.4.0 and v2.5.0? |
@mcollina to be fully honest (not that I don't want to blame anyone else but us aha), I'm not 100% sure. I'm testing on different environment and having the version downgrade to see if it is the case :
I'll let you know if I can find something more useful than this :/ |
@milanito if you understand what's happening, would you mind adding a failing unit test to reproduce and send a PR? |
@mcollina If I'm able to, of course |
From what I have seen at the moment :
it works. I did try to remove the I also did try to modify the default So I guess, basically on my end, it is more a question of mosca to make my life complete ( :p ), but I can maybe head there to ask why the default host is |
I'm a bit lost, as I am missing why the hostname at which the broker listen causes MQTT.js to error. |
In my case, if I don't put the |
Having the same issue, it's driving me crazy - the same mqtt code works in one heroku instance I have but doesn't work in another instance that's exactly the same. It connects to the MQTT server just fine, but then throws a 'offline' event, then instantly attempts to reconnect again.
|
It seems we can close this now. Feel free to open a new issue if it is still an issue. |
I'm getting this exact pattern on iOS when people are on their data plan. I've reverted to 1.4.1 which fixed the looping issue and I'm gonna see which version broke things and hopefully track the details down. |
Upgrading from 2.4.0 to 2.8.2 made the issue worse. With 2.4.0 we were only seeing this happen when the app was in the background for a while, but with 2.8.2 it happens after the first time we connect. Sadly we can't debug the problem with breakpoints because connecting the debugger makes the problem go away. |
@RangerMauve can you upload a script/project that reproduces the problem, ideally just using Node.js? Or if you understand why this is happening, can you send a PR? |
So far we're only seeing this happening on iOS when users are on a mobile network. I'm not yet sure if it's entirely the client-side that's causing trouble, or if it's related to our broker misbehaving. |
Seems that a change in 2.0.0 effected the issue. Gonna dig around in the code tomorrow. |
@RangerMauve Were you able to find a cause for this issue? I'm having a similar problem. |
@marleau Sorry for the lack of follow up! Sadly I didn't find the issue and we ended up downgrading our version of mqtt.js for that project. 1.14.1 is what we're using actively right now and it's working fine for all use cases. |
How to fix it? |
This is an automated message to let you know that this issue has If this issue is still important, you can simply comment with a Thank you for your contribution. |
This issue was automatically closed due to inactivity. |
Hey, could anybody find a solution to this? |
@jaganpaladin did you tried with latest version? |
Hey @robertsLando , I tried with 5.3.0. what version can should I try with? |
@jaganpaladin Could you provide a script to repro the issue? |
Hey @robertsLando , thanks for the prompt response. Here's a sample code.
So, i'm trying to run this as a google cloud function so that i can return the mqtt response to my front end over a http based APIs. Here's how it goes:
Hope this helps. |
@jaganpaladin That piece of code is a standard mqtt client connection, I'm using mqttjs in lot of project both on frontend and backend side and I never faced such problem. I have a feel this is something related to broker side. I suggest you to try reproduce the issue using paho-mqtt or other mqtt clients to see if they have the same behaviour |
Hi @robertsLando , thank you. I'll try that and let you know. |
Hi All, here is my es6 file, please tell why the close event is trigerred immediately after connect
Node: 6.10.0
Running Docker Instance From : https://hub.docker.com/r/toke/mosquitto/~/dockerfile/
Is this the right way exporting the client object ?. Please do recommend me some best practices.
The text was updated successfully, but these errors were encountered: