Use window.location.protocol to choose between ws:// and wss:// shcheme.

Pull request for fixing issue #106