I don’t think I ever have posted such an example, and if I did, please tell me where so that I can delete that. Simulating key presses is not a way of keeping games in sync. Instead, you should send for example the position of an object, since with that you are guaranteed that the mutation to the state of a game you make will make it reflect the other game’s state.
If it is not smooth enough, use tweens instead of setting the position to the newly sent one to still have some movement until the next position update.
Here is a post with some examples events: