I am using javascript to send a bench of request at regular interval (every 5 ms).
I tried to use setTimeout and also sleep function, but none of them have accurate timing.
They ensure that the time interval is >= 5ms but not == 5ms.
Any idea?
It seems that this very difficult to achieve in javascript or even impossible!!
This is the code I am using:
function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
}
async function sendRequest(){ 
    var i;
    for (i=1; i<= numberOfRequests; i++){
        // send my i^th request here
        await sleep(5);
    }
}
 
     
    