use wss in https, use http in other protocols
Merge pull request #141 from markee/check-https-first

use wss in https, use http in other protocols