using only one websocket per browser tab instead of per game. moved js into separate file