iheb_jabri's avatar

Efficiently Fetching Real-Time Odds from BetsAPI Without Overloading Requests

Hello everyone,

I’m working on a sports betting website and need to fetch data from an API called BetsAPI to retrieve events and odds. The challenge is that odds change frequently—sometimes multiple times per second. It’s not practical to send a request for every event every second due to the high resource consumption.

Does anyone have any suggestions or solutions for handling this efficiently?

Thank you in advance!

0 likes
1 reply
CorvS's avatar

That depends on your requirements. How up-to-date does the data (odds) have to be? You could take one of the following approaches:

  • Implement polling and fetch new odds every 5 seconds for example.
  • Make use of Broadcasting in combination with a job that queries the external API and sends updates to the frontend.
  • In case your external API offers webhooks you can "subscribe" for updates there.

Please or to participate in this conversation.