Real Time Notifications
Sort uses Pusher to manage all real-time notifications, which makes it extremely easy to integrate with almost any application.
Real-time notifications are only supported for sponsored contracts.
Installation
# You'll first need to install the pusher dependency from npm
npm install pusher
Configuration
// To listen to Sort's real-time notifications, construct your pusher
// instance with the following Sort id.
const SORT_PUSHER_ID = 'ac91a1d4157ccb9e4203';
const pusher = new Pusher(SORT_PUSHER_ID, { cluster: 'us2' });
Listening for events
// To listen for new contract transactions, subscribe() to the contract address
// and bind() to the 'new' event.
const channel = pusher.subscribe('CONTRACT_ADDRESS')
// Listen for new events
channel.bind('new', (transaction) => {
console.log("New decoded transaction", transaction);
})
Read more about Pusher in their documentation.
β
Updated 24 days ago