If HTTPS then WSS
This commit is contained in:
@ -152,8 +152,13 @@ const MopidyMiddleware = (function(){
|
||||
|
||||
var state = store.getState();
|
||||
|
||||
if (window.location.protocol == 'https'){
|
||||
var protocol = 'wss'
|
||||
} else {
|
||||
var protocol = 'ws'
|
||||
}
|
||||
socket = new Mopidy({
|
||||
webSocketUrl: 'ws://'+state.mopidy.host+':'+state.mopidy.port+'/mopidy/ws',
|
||||
webSocketUrl: protocol+'://'+state.mopidy.host+':'+state.mopidy.port+'/mopidy/ws',
|
||||
callingConvention: 'by-position-or-by-name'
|
||||
});
|
||||
|
||||
|
||||
@ -15,7 +15,8 @@ export default function reducer(mopidy = {}, action){
|
||||
case 'MOPIDY_SET_CONFIG':
|
||||
return Object.assign({}, mopidy, {
|
||||
host: action.host,
|
||||
port: action.port
|
||||
port: action.port,
|
||||
ssl: action.ssl
|
||||
});
|
||||
|
||||
case 'MOPIDY_CHANGE_TRACK':
|
||||
|
||||
@ -72,8 +72,14 @@ const PusherMiddleware = (function(){
|
||||
if( state.pusher.username ) connection.username = state.pusher.username;
|
||||
connection.username = connection.username.replace(/\W/g, '')
|
||||
|
||||
if (window.location.protocol == 'https'){
|
||||
var protocol = 'wss'
|
||||
} else {
|
||||
var protocol = 'ws'
|
||||
}
|
||||
|
||||
socket = new WebSocket(
|
||||
'ws://'+state.mopidy.host+':'+state.mopidy.port+'/iris/ws',
|
||||
protocol+'://'+state.mopidy.host+':'+state.mopidy.port+'/iris/ws',
|
||||
[ connection.clientid, connection.connection_id, connection.username ]
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user