(refactoring) Corrected error handling when setting up web socket.
Documentation corrections.