Skip to content

Commit d7da02d

Browse files
author
yckj0834
committed
finish v3
1 parent 1b32eb4 commit d7da02d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/views/pty/xterm3.vue

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import * as search from 'xterm/lib/addons/search/search'
2828
2929
import 'xterm/lib/addons/fullscreen/fullscreen.css'
3030
import 'xterm/dist/xterm.css'
31-
// import config from '@/config/config'
3231
3332
const defaultTheme = {
3433
foreground: '#ffffff', // 字体
@@ -54,13 +53,14 @@ const defaultTheme = {
5453
}
5554
const bindTerminalResize = (term, websocket) => {
5655
const onTermResize = size => {
57-
websocket.send(
58-
JSON.stringify({
59-
type: 'resize',
60-
rows: size.rows,
61-
cols: size.cols
62-
})
63-
)
56+
// websocket.send(
57+
// JSON.stringify({
58+
// type: 'resize',
59+
// rows: size.rows,
60+
// cols: size.cols
61+
// })
62+
// )
63+
websocket.send('2' + Base64.encode(size.rows + ':' + size.cols))
6464
}
6565
// register resize event.
6666
term.on('resize', onTermResize)
@@ -95,9 +95,9 @@ const bindTerminal = (term, websocket, bidirectional, bufferedTime) => {
9595
// cmd: Base64.encode(data) // encode data as base64 format
9696
// })
9797
// )
98-
websocket.send(data)
98+
websocket.send('0' + Base64.encode(data))
9999
100-
term.write(data)
100+
// term.write(data)
101101
}
102102
103103
websocket.onmessage = handleWebSocketMessage
@@ -108,7 +108,7 @@ const bindTerminal = (term, websocket, bidirectional, bufferedTime) => {
108108
// send heartbeat package to avoid closing webSocket connection in some proxy environmental such as nginx.
109109
const heartBeatTimer = setInterval(function() {
110110
// websocket.send(JSON.stringify({ type: 'heartbeat', data: '' }))
111-
websocket.send('ping\r\n')
111+
websocket.send('1')
112112
}, 20 * 1000)
113113
114114
websocket.addEventListener('close', function() {

0 commit comments

Comments
 (0)