I'm using dfuse streaming API to built a EOS based application. I want to keep an in-sync view of all the data flowing through my smart contract.
I want to ensure that I will always be in sync so I never miss a single block. Using the dfuse streaming API, how can I achieve that?
Using the
with_progressfeature of the Websocket API, you will receive oneprogressmessage after each block was processed.For a given stream (corresponding to a request and an associated
req_id), when you received aprogressfor a block, you are guaranteed to have seen all the contents it contained in your query (the actions forget_action_traces, or the rows forget_table_rows).If you keep track of that
block_numand/orblock_id, upon disconnection/reconnections, you can provide it back in your request, and be guaranteed never to miss a beat, even if that means you're reprocessing 1M blocks.As of November 22nd 2018, the
get_table_rowsrequest will streamtable_deltamessages that include an"undo"/"redo"step. This allows your app to navigate forks and ensure absolute sync of your application with the longest chain's state.Check the docs at https://docs.dfuse.io/ and search for
with_progressfor more details.