Skip to content

Commit 0aab08e

Browse files
authored
Add proxied websocket support
Add websocket support through a proxied server.
1 parent 9288a03 commit 0aab08e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

labextension/vpython/src/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
NotebookPanel, INotebookModel
1515
} from '@jupyterlab/notebook';
1616

17-
17+
import { PageConfig } from '@jupyterlab/coreutils';
1818

1919
/**
2020
* The plugin registration information.
@@ -47,8 +47,13 @@ class VPythonExtension implements DocumentRegistry.IWidgetExtension<NotebookPane
4747
glowcommlab.comm = vp_comm
4848
vp_comm.onMsg = glowcommlab.onmessage
4949

50-
glowcommlab.setupWebsocket(commMsg)
50+
// Get base URL of current notebook server
51+
let baseUrl = PageConfig.getBaseUrl()
52+
53+
// Construct URL of our proxied service
54+
let serviceUrl = base_url + 'proxy/' + port;
5155

56+
glowcommlab.setupWebsocket(commMsg, serviceUrl)
5257
});
5358

5459
vp_comm.onClose = (msg) => {console.log("comm onClose");};

0 commit comments

Comments
 (0)