mirror of
https://git.tuxpa.in/a/code-server.git
synced 2024-12-27 20:55:25 +00:00
Open websocket on same path as page (#149)
This is the critical piece to let you serve code-server proxied under a path. Otherwise if you proxy e.g. `/editor/` thru to `http://localhost:8000`, everything works fine except the websocket connection is still opened to `/`
This commit is contained in:
parent
30d14eeab4
commit
d7a66e4f15
@ -91,8 +91,9 @@ class WebsocketConnection implements ReadWriteConnection {
|
||||
*/
|
||||
private async openSocket(): Promise<WebSocket> {
|
||||
this.dispose();
|
||||
const wsProto = location.protocol === "https:" ? "wss" : "ws";
|
||||
const socket = new WebSocket(
|
||||
`${location.protocol === "https:" ? "wss" : "ws"}://${location.host}`,
|
||||
`${wsProto}://${location.host}${location.pathname}`,
|
||||
);
|
||||
socket.binaryType = "arraybuffer";
|
||||
this.activeSocket = socket;
|
||||
|
Loading…
Reference in New Issue
Block a user