We have websockets to listen for user updates, but what if we had webhooks instead?

The current implementation of websockets is great for reacting to order changes as quick as possible. However, scalability (for example, if you were to listen for updates for a whole menagerie of users) is an absolute nightmare. It also feels wrong keeping a websocket that only receives new updates once every few minutes (if that, sometimes it can be hours) open just pinging heartbeat. I dream of having user level webhooks I can listen to instead. Is that something that is implemented somewhere?

Hi @iketheguy! Unfortunately for the moment we do not have updates around a user level webhook.

An alternative approach to achieve similar results would be periodically polling the API for updates related to user activity. This can be done by implementing a scheduled job or a recurring task that queries the API at regular intervals to retrieve the latest user-specific data, such as order status, account balances, or trade history. By comparing the retrieved data with the previous state, it is possible to identify and react to changes in user activity.

To implement a scheduled job or a recurring task in JavaScript that queries an API at regular intervals to retrieve user-specific data, you can use the node-cron library. This library allows you to schedule and run tasks using the cron syntax. Here’s an example of how to achieve this: npm install node-cron
Then use the code below:

const cron = require('node-cron');
const axios = require('axios');

// Schedule a task to run every 5 minutes
cron.schedule('*/5 * * * *', async () => {
  try {
    // Make a request to the API to retrieve user-specific data
    const response = await axios.get('https://api.example.com/user-data');

    // Process the retrieved data and compare it with the previous state
    // Identify and react to changes in user activity
    console.log('Retrieved user-specific data:', response.data);
    // Your custom logic here
  } catch (error) {
    console.error('Error retrieving user-specific data:', error);
  }
});

Till the time we do not bring any user level webhook, you can also use services and middleware that can help you implement user-level webhooks or notifications. We would suggest to do your own research before picking one up.

We hope this helps for now.
Thank you :slight_smile:

It is frustrated me. we need the real time update with using ws.
How could I connect with your team to help them?