Feedback on Pull Request - RE: Session cancellation and reconnection

Hi MarkFo, Jonas, Anton,
 
thanks for the pull request, I agree it's good to have the distinction between join and startSession. Also, it's good to start the algorithms sections.

> The outcome of this sub-thread was a proposal made by Anton and Jonas 
> that would make the interface look like the following: 
> partial interface NavigatorPresentation {
>   Promise<PresentationSession> startSession(
>      DOMString url, DOMString sessionId);
>  Promise<PresentationSession> joinSession(
>      DOMString url, DOMString sessionId);
> }
 
> Note, also, that the mozilla-dev@ thread expressing intent to implement 
> uses the start/join flavor of the API (without Promises);

Before merging, I would like to briefly revisit the questions of the return type here.

Looking at the new example code (thanks for updating it!) – mixing Promises and the onstatechange event on the PresentationSession looks perhaps a bit more complicated than it needs to be. The steps of how a PresentationSession gets connected and usable are now spread across a Promise and the onstatechange handler, the developer using our API has to track both. 

Would it be more consistent to just return a session object, for which we could define an additional - for example - "Idle" state, or use the "Disconnected" state as well, then transition that to "Connected". This would still allow showing the user selection dialog asynchronously, and we would not need to map the transitions to Promise-resolution and PresentationSession state separately? If that sounds okay to you, I am happy to edit and update the pull request in this regard.

One particular overlap/redundancy I see for example: When the Promise is resolved successfully from startSession or joinSession, is the session object is immediately in "connected" state? So the only transition on the onstatechange handler we would ever see is the one from "connected" to "disconnected"?

Dominik

Received on Wednesday, 17 September 2014 19:46:29 UTC