Skip to content

Gracefully handle session termination and reconnect #246

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

Closed
Privat33r-dev opened this issue Apr 29, 2024 · 1 comment
Closed

Gracefully handle session termination and reconnect #246

Privat33r-dev opened this issue Apr 29, 2024 · 1 comment

Comments

@Privat33r-dev
Copy link
Contributor

While testing #244 I noticed that websocket session state change is not being handled gracefully.

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.

I am not sure which protocol is used exactly, but I guess that these cases should be documented there

@Privat33r-dev
Copy link
Contributor Author

Opened issue in the correct repo, closing this one.

@Privat33r-dev Privat33r-dev closed this as not planned Won't fix, can't repro, duplicate, stale Apr 30, 2024
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