How to grab zed object detection detected object_list periodically (scheduling the task that grabs objects found by zed camera)

Hi I was wondering what would be the best way to achieve the feat mentioned in the title. Thing is I would like to send through websocket the information that zed camera’s object detection module provides for us every 300ms or 500ms. I tried out the python example of object detection and inside the infinite while loop I put time.sleep(0.5) at the end of the loop, but this seems like a very dangerous thing to do and as such I was wondering what would be the best way to periodically check.