Polling

Polling involves periodically making requests to our system to check for new events or information. If new information is found, a response is returned with the new information in its payload. If no new information is found, nothing is returned.

Use polling when you want to specify when and how often to receive updates.

You can use polling to retrieve device information for specific modules:

  • Live map location of one or multiple devices
  • Status of one or multiple devices (offline, standby, or online)

With polling, the API and device interact in the following way:

APIDevicePOLLLocation/status20 secondsPOLLLocation/status20 secondsPOLLLocation/statusAPIDevice

Polling best practices

Polling is resource intensive, so only use it when necessary.

  • Only use polling to show the live location of a device while a user is actively using the maps module of your application. We recommend using one of the following:

    • websocket
    • DOM event listeners to know when a user is actively using the maps module.
  • Polling should be done every 20 seconds or longer.

Surfsight monitors all API requests and lets you know if there is an overuse of the API requests in your application.