check window.location.protocol to set ws protocol secure or not