mirror of
https://github.com/alibaba/arthas.git
synced 2024-04-21 10:21:39 +00:00
fix web console js do not close connect problem; fix js ws send state problem. #1345
This commit is contained in:
@@ -105,6 +105,7 @@ function startConnect (silent) {
|
||||
// init webSocket
|
||||
initWs(ip, port);
|
||||
ws.onerror = function () {
|
||||
ws.close();
|
||||
ws = null;
|
||||
!silent && alert('Connect error');
|
||||
};
|
||||
@@ -128,7 +129,7 @@ function startConnect (silent) {
|
||||
});
|
||||
ws.send(JSON.stringify({action: 'resize', cols: terminalSize.cols, rows: terminalSize.rows}));
|
||||
window.setInterval(function () {
|
||||
if (ws != null) {
|
||||
if (ws != null && ws.readyState === 1) {
|
||||
ws.send(JSON.stringify({action: 'read', data: ""}));
|
||||
}
|
||||
}, 30000);
|
||||
@@ -137,6 +138,7 @@ function startConnect (silent) {
|
||||
|
||||
function disconnect () {
|
||||
try {
|
||||
ws.close();
|
||||
ws.onmessage = null;
|
||||
ws.onclose = null;
|
||||
ws = null;
|
||||
|
||||
@@ -116,6 +116,7 @@ function startConnect (silent) {
|
||||
// init webSocket
|
||||
initWs(ip, port, agentId);
|
||||
ws.onerror = function () {
|
||||
ws.close();
|
||||
ws = null;
|
||||
!silent && alert('Connect error');
|
||||
};
|
||||
@@ -144,7 +145,7 @@ function startConnect (silent) {
|
||||
});
|
||||
ws.send(JSON.stringify({action: 'resize', cols: terminalSize.cols, rows: terminalSize.rows}));
|
||||
window.setInterval(function () {
|
||||
if (ws != null) {
|
||||
if (ws != null && ws.readyState === 1) {
|
||||
ws.send(JSON.stringify({action: 'read', data: ""}));
|
||||
}
|
||||
}, 30000);
|
||||
@@ -153,6 +154,7 @@ function startConnect (silent) {
|
||||
|
||||
function disconnect () {
|
||||
try {
|
||||
ws.close();
|
||||
ws.onmessage = null;
|
||||
ws.onclose = null;
|
||||
ws = null;
|
||||
|
||||
Reference in New Issue
Block a user