Relax `terminate` algorithm to deal with other states? #421
Comments
tidoust
referenced
this issue
in w3c/web-platform-tests
Apr 12, 2017
Merged
[presentation-api] add test cases for sending/receiving messages by a receiving user agent #5520
|
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 |
anssiko
referenced
this issue
Apr 18, 2017
Closed
[meta] Publish a revised Candidate Recommendation #406
|
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. |
mfoltzgoogle
referenced
this issue
May 2, 2017
Merged
Allow termination via connections in a connecting state. #427
|
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. |
|
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. |
tidoust commentedApr 12, 2017
The
terminatemethod only has an effect on a presentation connection whose state isconnected.I think a common scenario for calling
terminateis 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
terminateonly works onconnectedpresentations, 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 theterminatealgorithm so that:connectingstate. The user agent would wait for the underlying connection to becomeconnected.closedstate. 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
closedstate 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.