Automatic session resumption

Dear community group members,

We would like to propose adding a way for the page to automatically
reconnect to a session running on a second UA, without reprompting the user
for screen selection.

IDL:

partial interface Presentation {
  PresentationSession[] activeSessions();
  EventHandler onsessionchange;
}

Code snippet:

var mySession = null, myUrl = “www.example.com/receiver”;

var found = presentation.activeSessions().some(function(session, index,
array) {

 if (session.url == myUrl) { mySession = session; return true; }

return false;

});


if (!found) {

 // no active sessions, we'll either get a session from requestShow() or
from

// the onsessionchange event listener.

mySession = null;

};

presentation.onsessionchange = function(e)  {

  var session = e.session;

  if (session == mySession) {

    // got an update for the session started/joined from this page

  } else {

    // |session| isn’t a session this page has started/joined,

    // use it or not - up to the page

  }

}

Semantics:

If the browser has previously connected to any session or multiple sessions
via |requestSession()| called from the same origin, e.g. '
http://example.com/sender', the |activeSessions()| array will contain the
list of the session objects that can be used immediately from the current
page.

|onsessionchange| event will be fired about the state change of any session
started from the same origin as the current page.

Rationale:
This permits a user to navigate a site (scoped by origin) while controlling
the same instance of the presentation session, without having to interact
with the browser to reconnect to the second screen each time.

Limitations:
|activeSessions()| and |onsessionchange| will only work for a session that
was started on the same browser from the same origin.  It will not return
sessions started by other browsers.

We also want to add a way to disassociate an origin from a session, which
would prevent the session to be visible to the pages with the origin.  This
would be called e.g. when the user logged out from the site.

Thanks,
Anton and Mark.

Received on Tuesday, 15 April 2014 07:57:06 UTC