Build a Simple dApp in 3 Mins - Real-Time Transactions (Part 4)
Build Your First Moralis dApp! This Guide Series Covers the Basics and How to Get Started Fast. In Part Four, We Subscribe to Our Query to Get Real-Time Alerts.
How to Get Real-Time Data
Not only can we get all past transactions, but we can also get notifications when new transactions happen!
Just Subscribe to the Query
And Handle the Events
That's it!... we can modify our getUserTransactions()
function as follows:
Now, whenever the user makes a new transaction on the mainnet, it will print a message. Note: on new nitro servers (the ones that have coreservices plugin), update instead of create should be used for subscription.
Outstanding!
Real-time action! Can't stop now, we're almost to the finish line... keep going!
pageBuild a Simple dApp in 3 Mins - Cloud Functions (Part 5)PreviousBuild a Simple dApp in 3 Mins - Historical Transactions (Part 3)NextBuild a Simple dApp in 3 Mins - Cloud Functions (Part 5)
Last updated