default long polling in socket.io (in config.js)
This commit is contained in:
parent
a70fd64442
commit
923a0bb975
7 changed files with 75 additions and 43 deletions
|
|
@ -264,7 +264,7 @@ Network.prototype._setupConnectionHandlers = function(opts, cb) {
|
|||
|
||||
self.socket.on('connect', function() {
|
||||
var pubkey = self.getKey().public.toString('hex');
|
||||
log.debug('Async subcribing to:pubkey:',pubkey);
|
||||
log.debug('Async subscribing to:pubkey:',pubkey);
|
||||
|
||||
self.socket.emit('subscribe', pubkey);
|
||||
|
||||
|
|
@ -325,7 +325,10 @@ Network.prototype.start = function(opts, openCallback) {
|
|||
|
||||
preconditions.checkState(this.connectedPeers && this.connectedPeers.length === 0);
|
||||
|
||||
if (this.started) return openCallback();
|
||||
if (this.started) {
|
||||
log.debug('Async: Networing already started for this wallet.')
|
||||
return openCallback();
|
||||
}
|
||||
|
||||
this.privkey = opts.privkey;
|
||||
this.setCopayerId(opts.copayerId);
|
||||
|
|
@ -336,8 +339,7 @@ Network.prototype.start = function(opts, openCallback) {
|
|||
};
|
||||
|
||||
Network.prototype.createSocket = function() {
|
||||
|
||||
console.log('Async: Connecting to socket:', this.url, this.socketOptions); //TODO
|
||||
log.debug('Async: Connecting to socket:', this.url, this.socketOptions);
|
||||
return io.connect(this.url, this.socketOptions);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -127,7 +127,8 @@ Identity.create = function(email, password, opts, cb) {
|
|||
cb(null, iden);
|
||||
|
||||
// default wallet
|
||||
var wopts = _.extend(opts.walletDefaults, {
|
||||
var dflt = _.clone(opts.walletDefaults);
|
||||
var wopts = _.extend(dflt, {
|
||||
nickname: email,
|
||||
networkName: opts.networkName,
|
||||
requiredCopayers: 1,
|
||||
|
|
@ -447,7 +448,6 @@ Identity.prototype._checkVersion = function(inVersion) {
|
|||
* @return
|
||||
*/
|
||||
Identity.prototype.openWallet = function(walletId, password, cb) {
|
||||
console.log('[Identity.js.434:openWallet:]', walletId); //TODO
|
||||
preconditions.checkArgument(cb);
|
||||
var self = this;
|
||||
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ Insight.prototype.subscribeToBlocks = function() {
|
|||
|
||||
/** @private */
|
||||
Insight.prototype._getSocketIO = function(url, opts) {
|
||||
log.debug('Insight: Connecting to socket:', this.url, this.opts);
|
||||
return io(this.url, this.opts);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -869,6 +869,12 @@ Wallet.prototype.netStart = function() {
|
|||
var self = this;
|
||||
var net = this.network;
|
||||
|
||||
if (net.started) {
|
||||
log.debug('Wallet networking was ready')
|
||||
self.emit('ready', net.getPeer());
|
||||
return;
|
||||
}
|
||||
|
||||
net.removeAllListeners();
|
||||
net.on('connect', self._onConnect.bind(self));
|
||||
net.on('data', self._onData.bind(self));
|
||||
|
|
@ -2539,6 +2545,7 @@ Wallet.prototype.indexDiscovery = function(start, change, copayerIndex, gap, cb)
|
|||
*/
|
||||
Wallet.prototype.close = function(cb) {
|
||||
var self = this;
|
||||
this.network.cleanUp();
|
||||
log.debug('## CLOSING Wallet: ' + this.id);
|
||||
this.lock.release(function() {
|
||||
if (cb) return cb();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue