handle network reconnection
This commit is contained in:
parent
ff8560208b
commit
9efa2dfe24
16 changed files with 125 additions and 66 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue