If iam calling a function inside connection.onmessage (Websocket), how could I make sure that if multiple messages is encountered/recieved - the function must be called for