eosrio / hyperion-stream-client

Streaming API Client
MIT License
2 stars 6 forks source link

Stream is not picking up full history or live events #14

Open ryoung48 opened 1 year ago

ryoung48 commented 1 year ago

Description My goal is to use this stream to pick up historical and live actions for specific accounts on mainnet and testnet.

|endpoint                       |accounts   
---------------------------------------------------                    
https://mainnet.telos.net       |dapp.bennyfi
https://testnet.telos.net       |bennyfitestm

My socket setup is below:

import { HyperionStreamClient } from '@eosrio/hyperion-stream-client'

const client = new HyperionStreamClient({
  endpoint: 'https://mainnet.telos.net',
  debug: true,
  libStream: false
})

client.on('connect', () => {
  console.log('connected!')
})

client.setAsyncDataHandler(async payload => {
  console.log(
    `${payload?.content?.['@timestamp']} :: ${payload?.content?.act?.account} :: ${payload?.content?.act?.name} :: ${payload?.content?.block_num}`
  )
})

const main = async () => {
  await client.connect()
  client.streamActions({
    contract: 'dapp.bennyfi',
    action: '',
    account: '',
    start_from: '2020-03-15T00:00:00.000Z',
    read_until: 0,
    filters: []
  })
}

main()

According to https://mainnet.telos.net/v2/history/get_actions?filter=dapp.bennyfi%3A*, dapp.bennyfi should have many historical transactions. The client debugger reports a successful connection to the mainnet endpoint. However, the client only picks up ~20 historical actions starting on 2021-08-25T19:41:49.500 and then stops. It then proceeds to pick up more history at very irregular intervals every couple hours and has not yet picked up any live events. If I shift the start time, it will pick up another ~20 actions starting at the new start time and then halts. I do not see any console prints suggesting the socket has disconnected. Adding accounts and actions to the stream actions call does not seem to make any difference. I see similar behavior with https://testnet.telos.net and bennyfitestm. Is this kind of behavior expected? Am I using the stream incorrectly?

Environment node version: 16.14.2 hyperion-stream-client version: 1.0.3

kylanhurt commented 1 year ago

Yeah I have found the streaming of the actions to be very inconsistent, making it nearly unusable until this issue is fixed.