Use correct websocket protocol when using websocket_host/port settings

This commit is contained in:
Nick Steel 2015-08-25 15:50:28 +01:00
parent e71de0786e
commit d211b92447

View File

@ -39,7 +39,10 @@ class IndexHandler(tornado.web.RequestHandler):
port = config['http']['port']
logger.warning('Musicbox websocket_port not specified, '
'using %s', port)
ws_url = "ws://%s:%d/mopidy/ws" % (host, port)
protocol = 'ws'
if self.request.protocol == 'https':
protocol = 'wss'
ws_url = "%s://%s:%d/mopidy/ws" % (protocol, host, port)
self.__dict = {
'version': MusicBoxExtension.version,