meteor-smart-disconnect icon indicating copy to clipboard operation
meteor-smart-disconnect copied to clipboard

Notify of disconnect

Open janat08 opened this issue 7 years ago • 7 comments

Would be cool to have ui with the logic to have user know that he's disconnected.

janat08 avatar Sep 11 '17 08:09 janat08

+1 something like this would be great, and easy to implement

import { SmartDisconnect } from 'meteor/mixmax:smart-disconnect'

SmartDisconnect.on('disconnect', () => {
   alert('You have been disconnected because you weren\'t viewing the page');
});
SmartDisconnect.on('reconnect', () => {
   alert('You have been reconnected');
});

ejfrancis avatar Sep 11 '17 18:09 ejfrancis

Providing a hook may be better with alert in case you decide to get fancy with bert pack of notifications. I don't belief it automatically reconnects you, so using a menu with button for reconnecting may be better.

janat08 avatar Sep 11 '17 18:09 janat08

It also just occured to me that it should probably not enable for development environment.

janat08 avatar Sep 11 '17 18:09 janat08

https://github.com/mixmaxhq/meteor-smart-disconnect/blob/6996df5f6fb7a2dca4f7e458a2692fc88b0fe9d7/disconnect-when-backgrounded.js#L24 it looks like it should reconnect

ejfrancis avatar Sep 11 '17 19:09 ejfrancis

notifying of reconnect would be helpful for the sake of lag, while disconnect message then is somewhat pointless then?

janat08 avatar Sep 11 '17 20:09 janat08

actually, it looks like perhaps this can be covered by simply listening to the reactive data source Meteor.status() https://docs.meteor.com/api/connections.html

ejfrancis avatar Sep 11 '17 20:09 ejfrancis

sounds good - file a PR

bradvogel avatar Sep 11 '17 20:09 bradvogel