I'm using Hive-Blockchain SDK for NodeJS, hive-js I can successfully connect to the Blockchain, retrieves blocks and transactions via getBlockStream API, but I reach the end of the stream event, I do not find a standard way to restart the stream:
client.blockchain.getBlockStream({ mode: dhive.BlockchainMode.Latest })
.on('data', handleBlock)
.on('error', errorBlock)
.on('end', () => {
console.log('Reached end of stream')
// restart stream here?
});
In fact, it is possibile to pause the stream and resume:
//pause stream
pauseStream = async () => {
state = stream.pause();
};
//resume stream
resumeStream = async () => {
state = state.resume();
};
but apparently not to restart.