|
|
@ -14,7 +14,7 @@ |
|
|
|
You should have received a copy of the GNU Lesser General Public License |
|
|
|
You should have received a copy of the GNU Lesser General Public License |
|
|
|
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
/** @file websocket.js |
|
|
|
/** @file autoprovider.js |
|
|
|
* @authors: |
|
|
|
* @authors: |
|
|
|
* Marek Kotewicz <marek@ethdev.com> |
|
|
|
* Marek Kotewicz <marek@ethdev.com> |
|
|
|
* Marian Oancea <marian@ethdev.com> |
|
|
|
* Marian Oancea <marian@ethdev.com> |
|
|
@ -28,7 +28,7 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
if (process.env.NODE_ENV !== 'build') { |
|
|
|
if (process.env.NODE_ENV !== 'build') { |
|
|
|
var WebSocket = require('ws'); // jshint ignore:line
|
|
|
|
var WebSocket = require('ws'); // jshint ignore:line
|
|
|
|
var web3 = require('./web3'); // jshint ignore:line
|
|
|
|
var web3 = require('./main.js'); // jshint ignore:line
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var AutoProvider = function (userOptions) { |
|
|
|
var AutoProvider = function (userOptions) { |
|
|
@ -44,13 +44,13 @@ var AutoProvider = function (userOptions) { |
|
|
|
this.provider = new web3.providers.QtProvider(); |
|
|
|
this.provider = new web3.providers.QtProvider(); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
userOptions = userOptions || {}; |
|
|
|
userOptions = userOptions || {}; |
|
|
|
var options = { |
|
|
|
var options = { |
|
|
|
httprpc: userOptions.httprpc || 'http://localhost:8080', |
|
|
|
httprpc: userOptions.httprpc || 'http://localhost:8080', |
|
|
|
websockets: userOptions.websockets || 'ws://localhost:40404/eth' |
|
|
|
websockets: userOptions.websockets || 'ws://localhost:40404/eth' |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var self = this; |
|
|
|
var self = this; |
|
|
|
var closeWithSuccess = function (success) { |
|
|
|
var closeWithSuccess = function (success) { |
|
|
|
ws.close(); |
|
|
|
ws.close(); |
|
|
@ -71,7 +71,7 @@ var AutoProvider = function (userOptions) { |
|
|
|
var ws = new WebSocket(options.websockets); |
|
|
|
var ws = new WebSocket(options.websockets); |
|
|
|
|
|
|
|
|
|
|
|
ws.onopen = function() { |
|
|
|
ws.onopen = function() { |
|
|
|
closeWithSuccess(true);
|
|
|
|
closeWithSuccess(true); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
ws.onerror = function() { |
|
|
|
ws.onerror = function() { |
|
|
|