steem-js icon indicating copy to clipboard operation
steem-js copied to clipboard

Added stream functions to README.md in docs

Open MattyIce opened this issue 6 years ago • 2 comments

Added the following functions to the documentation:

  • streamBlockNumber
  • streamBlock
  • streamTransactions
  • streamOperations

MattyIce avatar Nov 20 '17 01:11 MattyIce

I was unaware that a steem node could do this, so upon digging a bit deeper I found that I seem to be correct, and basically all streamBlock() does is repeatedly poll the server for the latest block. While not ideal, it's still the only way to really do it at this point.

HOWEVER, watch the websocket connection frames after you call one of these functions...

steem.api.streamBlock('head', function(err, result) {
    console.log(err, result);
});

The way these functions are implemented, they're basically machine-gunning the requests so fast it'll make your head spin. There really should be a timer implemented in these functions so that at least they don't check more than once every second or so for the latest blocks to become available.

alexpmorris avatar Dec 11 '17 03:12 alexpmorris

You're right about how it works, it's not technically streaming. Nevertheless the functions exist but are undocumented so I sought to fix that is all.

MattyIce avatar Dec 11 '17 03:12 MattyIce