added functionality to keep a state in sync on the server so that newly connected clients have the entire history