detect https and switch websockets to wss if needed