Make the websocket_connect error handling more comprehensive.

Now covers successful http responses that return a non-websocket body
and network errors that prevent a body from being returned.

Added a connect_timeout parameter to websocket_connect.