Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gracefully handle session termination and reconnect #58

Open
Privat33r-dev opened this issue Apr 30, 2024 · 0 comments
Open

Gracefully handle session termination and reconnect #58

Privat33r-dev opened this issue Apr 30, 2024 · 0 comments

Comments

@Privat33r-dev
Copy link

Original issue: play-with-docker/play-with-docker.github.io#246

Reconnect

Screenshot

When server starts `reconnect` and then `connect`s again, it resends full input starting from the start of the session. The app is currently just ignoring "reconnect/connect" and sends the output from the start as is (see screenshot above).

The graceful handling of this case would be cleaning up previous input before setting received one (user's current input in the readline can be kept).

I guess that the code would look like somewhat like this:

    this.socket.on('reconnect', function(name ,data) {
      var instance = self.instances[name];
      if (instance && instance.terms) {
        instance.terms.forEach(function(term) {term.clear()});
      } else {
        self.instanceBuffer[name] = '';
      }
    });

I am not exactly sure though on this suggestion and would advise to refer to the protocol's documentation first.

"Session end"

{"name":"instance delete","args":["INSTANCE_ID"]}
{"name":"session end","args":null}

On receiving this input the client is expected to visually indicate to the user that session finished instead of keeping unresponsive console UI. Ideally, session restart should be offered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant