steemit / steem-js

Steem.js the official JavaScript library for Steem blockchain
https://www.npmjs.com/package/steem
MIT License
472 stars 225 forks source link

streamOperations with filter function #318

Open blueorbitz opened 6 years ago

blueorbitz commented 6 years ago

As far as my understanding goes, this stream operation basically return every operation on every user working on the network. Which will be quite heavy on a long run. As most of the cloud service have a bandwidth quota / restriction.

What I am trying to achieve is basically trying to have a real-time response similar to what websocket does.

aminraisy commented 6 years ago

exactly, and also functions that give special kind of operations like "transfer" or "custom_json"

inertia186 commented 6 years ago

As most of the cloud service have a bandwidth quota / restriction.

What you're asking for is not something steem-js can do (filtering to saving bandwidth). Yes, an API client can be designed to filter operations (steem-ruby does this). But an API client that filters does so by processing the entire stream. There would be no bandwidth benefit.

aminraisy commented 6 years ago

@inertia186 regardless of bandwidth issue through steem-js can we get just "transfer" operations of an account ? what about through restful APIs documented here https://developers.steem.io ?

inertia186 commented 6 years ago

Check here:

https://developers.steem.io/tutorials-recipes/virtual-operations-when-streaming-blockchain-transactions

We just published a new version of the devportal site and it includes an example at the very bottom on filtering by op type. It's a dsteem example, though. Full streaming tutorial here:

https://developers.steem.io/tutorials-javascript/stream_blockchain_transactions

aminraisy commented 6 years ago

I read your links. thanks alot . but as I understand currently we should get all transaction history and filter them by special op type that we need. no way to directly get just "transfer" type ops even with blockchain API or js libraries. am I right ?