-
Notifications
You must be signed in to change notification settings - Fork 40
Relax terminate
algorithm to deal with other states?
#421
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
Comments
If I'm not opposed to this change, but would need to investigate the implications for our implementation to determine the scope and complexity. It does seem to improve ergonomics for the cleanup case, but isn't the expected use case to simply allow the connection to be closed by the controlling UA on page unload? The presentation can close itself when it detects the connection has goneAway. I went ahead and thought through the implications for the API and what we signal to developers. When script calls I ask the following:
For The algorithm changes could be tricky given the fact that |
I think we should split this into two issues. The first is to allow The second is to allow termination of closed connections. This is a more fundamental rethink of the API and should be a v2 feature request. |
PR allows termination in a Maybe an implementation note clarifying that termination is best effort would be of use? I suspect that given the implementation and network dependence, that will always be the case for many operations in the API though. |
Right, |
PR merged; I don't plan on addressing the additional note or termination via closed connections at this time. I think this can be closed then. Feel free to file termination via closed connections as a feature request :) |
@tidoust, if you don't feel strongly about this, I'd give you an action to open a new issue for the feature request in question and close this issue when done. |
@anssiko @mfoltzgoogle I'll close this issue without creating another one for termination via closed connections. This issue captures the possible gain that this could bring in theory and the rationale for not doing it in practice. We can always refer back to this issue later on if the idea comes back onto the table. |
The
terminate
method only has an effect on a presentation connection whose state isconnected
.I think a common scenario for calling
terminate
is when the controlling browsing context is about to disappear or when the user clicks on a button, to clean things up, regardless of the current application state.This is what we try to do in the test suite for instance, so that subsequent tests start from a clean "no on-going presentation" state. However, since
terminate
only works onconnected
presentations, terminating a presentation no matter what turns out to be more complex that simply callingterminate
, leading to code such as:I'm wondering whether the user agent could take care of some of that complexity, ideally so that developers can end up with a simple
connection.terminate()
call. This would require relaxing theterminate
algorithm so that:connecting
state. The user agent would wait for the underlying connection to becomeconnected
.closed
state. The user agent would attempt to reconnect the underlying connection before it terminates it.The latter change may be more problematic, and it seems reasonable to expect applications to deal with connections in the
closed
state themselves. The former change seems easier and useful. If both changes are in place, developers can just issue a call toconnection.terminate()
and be done with it. If only the former change is in place, developers would have to write something like:... which seems acceptable.
The text was updated successfully, but these errors were encountered: