diff options
Diffstat (limited to 'lib/autoprovider.js')
-rw-r--r-- | lib/autoprovider.js | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/autoprovider.js b/lib/autoprovider.js index b05d4190a..470861686 100644 --- a/lib/autoprovider.js +++ b/lib/autoprovider.js @@ -28,9 +28,6 @@ */ if (process.env.NODE_ENV !== 'build') { var WebSocket = require('ws'); // jshint ignore:line -} - -if (process.env.NODE_ENV !== 'build') { var web3 = require('./web3'); // jshint ignore:line } @@ -59,10 +56,10 @@ var AutoProvider = function (userOptions) { ws.close(); if (success) { self.provider = new web3.providers.WebSocketProvider(options.websockets); - return; + } else { + self.provider = new web3.providers.HttpRpcProvider(options.httprpc); + self.poll = self.provider.poll.bind(self.provider); } - self.provider = new web3.providers.HttpRpcProvider(options.httprpc); - self.poll = self.provider.poll.bind(self.provider); self.sendQueue.forEach(function (payload) { self.provider(payload); }); |