Wss.
This commit is contained in:
parent
9a0d120ba4
commit
f3ec158338
7
demo.py
7
demo.py
@ -123,10 +123,9 @@ async def terminal(session_id: str):
|
|||||||
term.loadAddon(fitAddon);
|
term.loadAddon(fitAddon);
|
||||||
term.open(document.getElementById('terminal'));
|
term.open(document.getElementById('terminal'));
|
||||||
fitAddon.fit();
|
fitAddon.fit();
|
||||||
|
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||||
const ws = new WebSocket('ws://' + window.location.host + '/ws/{session_id}');
|
const ws = new WebSocket(protocol + '//' + window.location.host + '/ws/{session_id}');
|
||||||
|
ws.onopen = () => {{
|
||||||
ws.onopen = () => {{
|
|
||||||
const dims = {{ cols: term.cols, rows: term.rows }};
|
const dims = {{ cols: term.cols, rows: term.rows }};
|
||||||
ws.send(JSON.stringify({{ type: 'resize', data: dims }}));
|
ws.send(JSON.stringify({{ type: 'resize', data: dims }}));
|
||||||
}};
|
}};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user