Please make sure that you are connected to a stable network, whether it is Wi-Fi or mobile data (3G/4G/5G).
 
Even if the connection bars are full, this does not always guarantee a stable Internet connection as networks can sometimes slow down or get overburdened, especially if you are playing in a moving vehicle.

Keep in mind that if you are inactive for about a minute, you may lose your connection to the game, and this behaviour is not a bug.