handle network reconnection

This commit is contained in:
Matias Alejo Garcia 2015-04-13 14:58:07 -03:00
commit 9efa2dfe24
16 changed files with 125 additions and 66 deletions

View file

@ -13,6 +13,7 @@ angular.module('copayApp.services').factory('configService', function(localStora
// Bitcore wallet service URL
bws: {
url: 'http://162.242.245.33:3004/bws/api',
// url: 'http://localhost:3001/bws/api',
},
// insight

View file

@ -60,6 +60,20 @@ angular.module('copayApp.services')
root.walletClients[credentials.walletId] = client;
client.removeAllListeners();
client.on('reconnect', function() {
if (root.focusedClient.credentials.walletId == client.credentials.walletId) {
$rootScope.$emit('Local/Online');
}
});
client.on('reconnecting', function() {
if (root.focusedClient.credentials.walletId == client.credentials.walletId) {
$rootScope.$emit('Local/Offline');
}
});
client.on('notification', function(n) {
$log.debug('BWC Notification:', n);
notificationService.newBWCNotification(n,