meteor-smart-disconnect
meteor-smart-disconnect copied to clipboard
Notify of disconnect
Would be cool to have ui with the logic to have user know that he's disconnected.
+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');
});
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.
It also just occured to me that it should probably not enable for development environment.
https://github.com/mixmaxhq/meteor-smart-disconnect/blob/6996df5f6fb7a2dca4f7e458a2692fc88b0fe9d7/disconnect-when-backgrounded.js#L24 it looks like it should reconnect
notifying of reconnect would be helpful for the sake of lag, while disconnect message then is somewhat pointless then?
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
sounds good - file a PR