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

Event the presentation receiver when the last session has disconnected #194

mfoltzgoogle opened this issue Sep 15, 2015 · 3 comments


Copy link

commented Sep 15, 2015

This is forked from #35, to specifically request a feature whereby a lastsessionclosed event would be fired on navigator.presentation when the last session connected to the presentation was closed. The default behavior for this event would be to close the presentation document (similar to window.close()). The presentation could prevent this behavior by calling .preventDefault() on the event.

This proposal was outlined in #35 (comment).

The arguments for this feature:

  • The default behavior of calling .close() when there is only one controller attached to the TV is unchanged. Calling .close() in that scenario will close the application.
  • The default behavior when multiple parties are connected is that the application is closed when the last controller calls .close()
  • The application on the TV gets to make the ultimate decision about when the application is closed. (Unless the user overrides by closing the application through other means of course.)
  • The PresentationSession API continues to match WebSocket and RTCDataChannel, i.e. we still have just .send()/onmessage/.close() and with those functions behaving the same across all three interfaces.
  • So I think that what we should optimize for here is developer ergonomics and reducing the risk of bugs.

The arguments against:

  • Another common case is that the presentation should continue running when the controller is disconnected, i.e. I begin playing a movie using my laptop and then close the laptop.
  • We don't want accidental disconnections of controllers (i.e., network disruption) to stop a running presentation.
  • In a multiplayer game, the presentation may want to continue running to allow new players to join.
  • This is just syntactic sugar for listening to onsessionconnect and keeping track of the number of connected sessions, then calling window.close() when the count drops to zero.

This comment has been minimized.

Copy link

commented Sep 25, 2015

I don't think we need this any more actually.

I was mostly concerned about the scenario when a single controller has been connected, and that controller calls .close() to close the connection to the presentation. If we in that case wanted the presentation to automatically close, then we needed a default event to hang that closing action on.

But since we have .terminate(), and since @mfoltzgoogle in #35 indicated that other platforms don't close by default, then I think leaving the presentation open even if all controllers have .close()ed sounds fine.

And so in that case lastsessionclosed would just be a convenience feature which the page can easily live without by simply tracking closed sessions itself.

So I think we should just close this issue with no action.


This comment has been minimized.

Copy link

commented Sep 29, 2015

@mfoltzgoogle This was tagged for F2F discussion. If you feel this issue would benefit from F2F discussion keep this open. Otherwise, feel free to close and remove the F2F tag.


This comment has been minimized.

Copy link
Contributor Author

commented Oct 14, 2015

It seems that we are satisfied that this does not require further action. I'm assuming that the resolution of #201 leads to a solution that allows the close-on-disconnect behavior to be implemented by the presentation author if they desire.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.