Added Extra Error Checking for Websockets