Open SmartChain-AI opened 10 months ago
@SmartChain-AI did you ever figure out why the event listening is sometimes killed even though it's wrapped in a try/catch? I'm running into the same issue.
Related Discord thread w/ @jribbink: https://discord.com/channels/613813861610684416/1179900687258243102
There's actually some big changes coming to the fcl.events() feature. The previous implementation was fairly bug prone & used polling under the hood. However, the new implementation uses WebSockets to stream events instead and should be completely lossless & more responsive 🙂
Bad news: It's not currently available on mainnet. It's only on testnet so the changes have not yet been released to FCL.
For testnet, you can try it using a preview build of FCL (npm install @onflow/fcl@event-streaming)
Event streaming PR: https://github.com/onflow/fcl-js/pull/1794
@aautem @SmartChain-AI WebSocket event streaming has been deployed to mainnet now, so the tagged branch should be working on both testnet & mainnet & the latest flow-cli emulator. I'll work towards getting this into the latest alpha tagged branch and hopefully a stable release in the near future.
@jribbink Wow, that was fast, thanks for the update!
Current Behavior
So i'm using this to test for events https://github.com/orodio/flow-view-source/blob/master/src/pages/event.comp.js and it gives me the events I'm subscribed to. I'm using a polling rate of 3 seconds and was wondering how the heights are worked out for each poll because it seems like it skips some blocks. You can see in the screenshot the end of the last block range searched and the start of the next block range. What happens to the blocks in between? Also you can see it scans the same block range up to 3 times for some reason, why is that happening?
I'm also getting this problem that kills the event listening completely even though the rest call is wrapped in a try catch.
So many errors how is this done clean and for every block, no fail?
Expected Behavior
Expecting no errors
Steps To Reproduce
Using the following React script:
Environment
Here is the code put on Netlify so you can see the errors https://flowevents.netlify.app/ if you wait a minute or two you will see the script breaks completely and event listening stops running