There's no perfect solution, because the web introduces latency.
One common work-around is to make player movements have lag that depends on server round-trip time.
Thus, the player doesn't start (or stop) moving on the local screen until it gets the command from the server to do so.
This way, you know that the state on the server is always correct, and the state on the client simply mirrors the state on the server.
So if I got this correct, both players needs the server to tell the player to move. That is, even when the user press' the forward key, the actor wont start to move until it gets the response from the server? Like the first Quake game, with no client-side prediction?
I see that solution would work, but I need immediate response from inputs tho. Especially from the player which spawns objects.
I'm currently using a jitter-buffer on the receiving side, so it is already a little bit of excessive latency going on.
Thank you very much for replying anyway.
Do you know any other 'common' solution?