mirror of https://github.com/BTCPrivate/copay.git
add subscribed event
This commit is contained in:
parent
2c354525ea
commit
02b8ceb35e
|
@ -290,25 +290,12 @@ Network.prototype.start = function(opts, openCallback) {
|
||||||
this._setupConnectionHandlers(openCallback);
|
this._setupConnectionHandlers(openCallback);
|
||||||
this.socket.emit('subscribe', pubkey);
|
this.socket.emit('subscribe', pubkey);
|
||||||
|
|
||||||
|
|
||||||
var fromTs = opts.lastTimestamp + 1;
|
var fromTs = opts.lastTimestamp + 1;
|
||||||
var self = this,
|
var self = this;
|
||||||
tries = 0;
|
self.socket.on('subscribed', function(m) {
|
||||||
self.socket.on('insight-error', function(m) {
|
|
||||||
|
|
||||||
console.log('Retrying to sync...');
|
|
||||||
setTimeout(function() {
|
|
||||||
if (tries++ > 5) {
|
|
||||||
self.emit('serverError');
|
|
||||||
} else {
|
|
||||||
self.socket.emit('sync', fromTs);
|
|
||||||
}
|
|
||||||
}, 500);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
self.socket.emit('sync', fromTs);
|
self.socket.emit('sync', fromTs);
|
||||||
self.started = true;
|
self.started = true;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Network.prototype.createSocket = function() {
|
Network.prototype.createSocket = function() {
|
||||||
|
|
Loading…
Reference in New Issue