PropertiesChange with NetworkManager
nand87 opened this issue · 0 comments
nand87 commented
When I use NetworkManager I want to monitoring the change of an Interface (i.e. eth0, wlan0) when I plug the eth or when I connect the wlan; because I want to reconnect to my on-line broker.
The code that I use is:
var sessionBus = dbus.sessionBus();
sessionBus.getService('org.freedesktop.NetworkManager').getInterface(
'/org/freedesktop/NetworkManager',
'org.freedesktop.NetworkManager', function(err, notifications) {
notifications.on('PropertiesChanged', function() {
try{
client.end(true, function(){
console.log("Connection Forced to Close after Network Interface Changes");
});
}
catch(e)
{
console.log("Client already closed???");
}
console.log("Re-Subscribing");
client.reconnect();
});
});
Any suggestions to monitor that?
Thank you all