Skip to content

Commit

Permalink
html: show message on reconnect success
Browse files Browse the repository at this point in the history
  • Loading branch information
tsl0922 committed Dec 19, 2020
1 parent c62de53 commit 29ef8cb
Show file tree
Hide file tree
Showing 2 changed files with 544 additions and 534 deletions.
3 changes: 2 additions & 1 deletion html/src/components/terminal/index.tsx
Expand Up @@ -253,14 +253,15 @@ export class Xterm extends Component<Props> {
console.log('[ttyd] websocket connection opened');
this.backoff.reset();

const { socket, textEncoder, terminal, fitAddon } = this;
const { socket, textEncoder, terminal, fitAddon, overlayAddon } = this;
socket.send(textEncoder.encode(JSON.stringify({ AuthToken: this.token })));

if (this.reconnect) {
const dims = fitAddon.proposeDimensions();
terminal.reset();
terminal.resize(dims.cols, dims.rows);
this.onTerminalResize(dims); // may not be triggered by terminal.resize
overlayAddon.showOverlay('Reconnected', 300);
} else {
this.reconnect = true;
fitAddon.fit();
Expand Down

0 comments on commit 29ef8cb

Please sign in to comment.