4

I want to display information about Geth, specifically eth.getBlock("latest").number, in a Node.Js GUI. However, I'm not sure how to keep it updated. One solution is to request the information from the browser once every 5 seconds or so, but it doesn't look very elegant. Does web3 provide an event or something like that so that socket.io calls the clients with the updated information whenever a new block is downloaded?

Thanks,

1
  • I was going to answer this can be done using web3.js WebSocket provider and eth_newblockfilter RPC call, but then I did not find any working WebSocket examples or whether filter API supports push over WebSocket. Jan 20, 2017 at 9:38

1 Answer 1

1

This was discussed but has not been implemented yet: https://github.com/ethereum/EIPs/issues/51

You can subscribe in the backend to Geth and poll every second and update front end accordingly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.