Let me explain what I am trying to do:
const ws = new WebSocket(url);
ws.on('message', function (data) {
//some code
savetoToDB(result) //this is my function, that i want to be called once in a minute
});
So I making socket connection, and receive data like twice in a second. But i want to execute saveToDB function only once in a minute. How can i achieve that? Thanks!