W3C home > Mailing lists > Public > public-secondscreen@w3.org > October 2015

Re: [presentation-api] PresentationReceiver: rename getConnection() and getConnections()

From: Anton Vayvod via GitHub <sysbot+gh@w3.org>
Date: Wed, 07 Oct 2015 14:15:44 +0000
To: public-secondscreen@w3.org
Message-ID: <issue_comment.created-146207657-1444227343-sysbot+gh@w3.org>
I don't think we need to couple the events "the presentation is loaded
 and ready" with "there's a connection made".
The following would be more similar to how the availability is 
handled:

```javascript
navigator.presentation.receiver.then(function (receiver) {
  if (!receiver.connections.empty) receiver.connections[0].send("I'm 
ready to rock.");
```

So ```receiver``` would be a promise property that resolves once the 
page is loaded and/or is a presentation. It would have the standard 
sync value and an onchange event interface for connections.

I don't think we should distinguish the first connection from the rest
 given that:
a) there might not be any connections when the page is ready (e.g. if 
it becomes a presentation rather than it's launched from the 
controlling page)
b) the initial connection can always disconnect and the presentation 
might want to wait for another one 
c) there might be more than one connection made to the receiving 
context before the page has loaded and asked for connection(s)

Ideally we would have a way for the controller to specify if the 
presentation only supports one connection and then the presentation 
could use some simpler path but as of today, there's no way for the 
presentation or controller to require one persistent connection so 
it's up to the implementation.

-- 
GitHub Notif of comment by avayvod
See 
https://github.com/w3c/presentation-api/issues/201#issuecomment-146207657
Received on Wednesday, 7 October 2015 14:15:45 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 October 2015 14:15:46 UTC