YARN-9091. Improve terminal message when connection is refused. Contributed by Eric Yang

This commit is contained in:
Billie Rinaldi 2018-12-14 19:55:50 -08:00
parent 42297f7d99
commit 4f622337ee
1 changed files with 14 additions and 0 deletions

View File

@ -87,11 +87,25 @@
if (user != null) { if (user != null) {
url = url + "?user.name=" + encodeURI(user); url = url + "?user.name=" + encodeURI(user);
} }
document.title = getQueryVariable("container");
console.log(url); console.log(url);
var sock = new WebSocket(url); var sock = new WebSocket(url);
sock.addEventListener('open', function () { sock.addEventListener('open', function () {
term.attach(sock, true, true); term.attach(sock, true, true);
}); });
sock.addEventListener('close', function(event) {
switch(event.code) {
case 1000:
term.write('Remote Connection closed.');
break;
case 1008:
term.write('Remote Connection refused.');
break;
case 1001:
term.write('Remote Connection going away.');
break;
}
});
term.open(container); term.open(container);
term.winptyCompatInit(); term.winptyCompatInit();
term.fit(); term.fit();