File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -101,11 +101,17 @@ let DefaultLiveQueryController = {
101
101
if ( liveQueryServerURL && liveQueryServerURL . indexOf ( 'ws' ) !== 0 ) {
102
102
throw new Error ( 'You need to set a proper Parse LiveQuery server url before using LiveQueryClient' ) ;
103
103
}
104
-
104
+
105
105
// If we can not find Parse.liveQueryServerURL, we try to extract it from Parse.serverURL
106
106
if ( ! liveQueryServerURL ) {
107
- let host = CoreManager . get ( 'SERVER_URL' ) . replace ( / ^ h t t p s ? : \/ \/ / , '' ) ;
108
- liveQueryServerURL = 'ws://' + host ;
107
+ const tempServerURL = CoreManager . get ( 'SERVER_URL' ) ;
108
+ let protocol = 'ws://' ;
109
+ // If Parse is being served over SSL/HTTPS, ensure LiveQuery Server uses 'wss://' prefix
110
+ if ( tempServerURL . indexOf ( 'https' ) === 0 ) {
111
+ protocol = 'wss://'
112
+ }
113
+ const host = tempServerURL . replace ( / ^ h t t p s ? : \/ \/ / , '' ) ;
114
+ liveQueryServerURL = protocol + host ;
109
115
CoreManager . set ( 'LIVEQUERY_SERVER_URL' , liveQueryServerURL ) ;
110
116
}
111
117
You can’t perform that action at this time.
0 commit comments