jb_ as i said, you should move the logic to the server side of things (i guess you are running a nodejs server?) so that only the rendering is done on the client (ie only rendering will be paused when tabbed out and the logic of the game will keep running since that is done on the server)
This is even more important from a multiplayer pov since anything happening on the client is open for manipulation (cheating)
i thought about this alot before i wrote the network code, but i figured the best solution is to only send the user input commands to each other, since this is waaaaaaay less traffic. Doind the game on the sever would require to send each units position to the clients every 50ms (game is 20 ticks / sec). This would be a lot more traffic (a looooot). Right now traffic is ~2kb / sec. Traffic the other way would be more than 10 times as much, which is, in my opinion , too much for a game. Also i would need waaay more traffix limit on my server side, which means id have to pay more in the end. Also the server would use way more cpu load since for every game that is played at a time, the server would have to do all the calculations.