I am running a private ethereum blockchain on web3 version 1.0.0-beta.27 for testing purposes. The blockchain is mining and has two users, now I would like to subscribe to events in the blockchain and perform some actions. The code is below:
var Web3 = require("web3");
var ether_port = 'http://localhost:8545'
var web3 = new Web3(new Web3.providers.HttpProvider(ether_port));
web3.eth.subscribe("pendingTransactions"
, function(err, result){
if (err){ console.log(err) }
else { console.log("result: ", result) }
});
I am getting the following error :
Error: The current provider doesn't support subscriptions: HttpProvider
at Subscription.subscribe
Kindly Help.