settings: change Insight.js opts

This commit is contained in:
Manuel Araoz 2014-09-10 12:36:33 -07:00
commit 997c061b1a
2 changed files with 6 additions and 9 deletions

View file

@ -19,7 +19,7 @@ var defaultConfig = {
url: 'https://test-insight.bitpay.com:443' url: 'https://test-insight.bitpay.com:443'
}, },
livenet: { livenet: {
url: 'https:insight.bitpay.com:443' url: 'https://insight.bitpay.com:443'
}, },
}, },

View file

@ -15,9 +15,7 @@ var preconditions = require('preconditions').singleton();
subscribing to transactions on adressess and blocks. subscribing to transactions on adressess and blocks.
Opts: Opts:
- host - url
- port
- schema
- reconnection (optional) - reconnection (optional)
- reconnectionDelay (optional) - reconnectionDelay (optional)
@ -31,19 +29,18 @@ var preconditions = require('preconditions').singleton();
var Insight = function(opts) { var Insight = function(opts) {
preconditions.checkArgument(opts) preconditions.checkArgument(opts)
.shouldBeObject(opts) .shouldBeObject(opts)
.checkArgument(opts.host) .checkArgument(opts.url)
.checkArgument(opts.port)
.checkArgument(opts.schema);
this.status = this.STATUS.DISCONNECTED; this.status = this.STATUS.DISCONNECTED;
this.subscribed = {}; this.subscribed = {};
this.listeningBlocks = false; this.listeningBlocks = false;
this.url = opts.schema + '://' + opts.host + ':' + opts.port; this.url = opts.url;
alert(this.url);
this.opts = { this.opts = {
'reconnection': opts.reconnection || true, 'reconnection': opts.reconnection || true,
'reconnectionDelay': opts.reconnectionDelay || 1000, 'reconnectionDelay': opts.reconnectionDelay || 1000,
'secure': opts.schema === 'https' 'secure': opts.url.indexOf('https') > -1
}; };
this.socket = this.getSocket(); this.socket = this.getSocket();