couldn't find anything working similarly . It seems that is has been replaced by web3.eth.subscribe('newBlockHeaders' [, callback]); but that doesn't work with HTTP provider it seems ?
I'm getting bundle.js:51226 Error: The current provider doesn't support subscriptionsHttpProvider
Have i missed something or is it not supported anymore ? is it related to https://github.com/ethereum/go-ethereum/wiki/RPC-PUB-SUB ?
I have the same issue
It does work over WS thought btw :
1-geth -dev --ws --wsport 8545 --wsaddr 0.0.0.0 --wsorigins "*" --wsapi "eth,web3" --minerthreads "1" --etherbase "fdfgfd" -mine
2 -
export var web3 = new Web3(Web3.givenProvider || new Web3.providers.WebsocketProvider("ws://localhost:8545"));
web3.eth.subscribe('newBlockHeaders', function(error, result){
if (!error){
console.log(error);
}
}).on("data", function(blockHeader){
// will return the block number.
console.log(blockHeader.number);
});
also saw : https://github.com/ethereum/EIPs/issues/51 from @frozeman so i'm assuming it won't be supported over http anymore.
Please see this discussion: #937
I don't think it is appropriate to join the discussion at #937. But after I read along through whole thread, I think currently only WS and IPC can support web3.eth.event subscribing, for the stake of performance?
Most helpful comment
It does work over WS thought btw :
1-
geth -dev --ws --wsport 8545 --wsaddr 0.0.0.0 --wsorigins "*" --wsapi "eth,web3" --minerthreads "1" --etherbase "fdfgfd" -mine2 -
also saw : https://github.com/ethereum/EIPs/issues/51 from @frozeman so i'm assuming it won't be supported over http anymore.