HTTPS endpoint support

This is a simple change to allow for a WSS endpoint, primarily as IE doesn't seem to allow connecting from a HTTPS website to WS endpoint.

Apologies for any mess, my knowledge of Erlang is pretty minimal.