Added TLS support

Now the webclient detects whether the browser is using HTTP/S and
chooses WS/S accordingly for the WebSocket connection.
WebSocket error codes are nonexistent, and there is no way to
accept a self-signed certificate within the WebSocket API, so if a
certain close code happens during a certain connection state, the
webclient will throw up an alert telling the user what to do.