Synchronize script calls with the help of socket.io and callbacks