Skip to content
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

Reconnect and Offline events #112

Closed
mcollina opened this issue Jun 13, 2013 · 4 comments · Fixed by #183
Closed

Reconnect and Offline events #112

mcollina opened this issue Jun 13, 2013 · 4 comments · Fixed by #183

Comments

@mcollina
Copy link
Member

I think that the connect and close event in MqttClient, if they are not driven by the user (i.e. #end() is called) should not be emitted. Instead we should emit reconnect and offline, so we can distinguish between the two cases.

What do you think?

@adamvr
Copy link
Member

adamvr commented Jun 13, 2013

I'm not sure about suppressing them if they're not user driven but I definitely plan to add something like reconnect and offline.

@mcollina
Copy link
Member Author

In my code I had to change all client.on("connect") into client.once("connect"), and the very same for close.

@adamvr
Copy link
Member

adamvr commented Jun 13, 2013

It is, admittedly, a bit of a pain in the arse to have to check client.disconnecting on every close to see if it's actually going to stay disconnected. What's your use case for it, outside of cleaning up once the client disconnects?

@mcollina
Copy link
Member Author

Actually the clients I was firing up in my Mosca tests kept reconnecting.

A part from that, it is much related to setting up everything correctly for each client after connect and tearing everything down on close. That code was pre-offline and pre-reconnect: it is very possible I could get rid of it totally.

The real error was releasing offline & reconnect without changing the "minor" version number: with this API, you should never want to listen to these events anyway. However, if there is a valid use case I will fire two events, connect and close for an "online+offline" closing and reconnect and offline for the reconnection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants