opened xhr connection and handled the post messages in the server