@@ -216,13 +216,14 @@ function renderLineMarkers() {
216216 document . body . append ( markerStyle )
217217}
218218
219- const host = window . location . hostname ;
220219const queryString = window . location . search ;
221220const queryParams = new URLSearchParams ( queryString ) ;
222- const ws = parseInt ( queryParams . get ( "ws" ) ) ;
223221const showMarkers = queryParams . has ( "show-markers" )
224222
225- const wsServer = `ws://${ host } :${ ws } `
223+ const wsScheme = ( window . location . protocol === 'https:' ) ? 'wss' : 'ws'
224+ const wsHost = window . location . hostname ;
225+ const wsPort = parseInt ( queryParams . get ( "ws" ) ) ;
226+ const wsServer = `${ wsScheme } ://${ wsHost } :${ wsPort } `
226227console . debug ( `Connecting to '${ wsServer } '...` )
227228
228229const socket = new WebSocket ( wsServer ) ;
@@ -242,7 +243,7 @@ const handlers = {
242243 console . debug ( "Reloading page..." )
243244 window . location . reload ( )
244245 } ,
245- "view/scroll" : ( params ) => { scrollViewTo ( params . uri , params . line ) }
246+ "view/scroll" : ( params ) => { scrollViewTo ( params . uri , params . line ) }
246247}
247248
248249function handle ( message ) {
@@ -291,7 +292,7 @@ function main() {
291292 renderLineMarkers ( )
292293 }
293294
294- rewriteInternalLinks ( ws )
295+ rewriteInternalLinks ( wsPort )
295296
296297 // Are we in an <iframe>?
297298 if ( window . parent !== window . top ) {
0 commit comments