Re: [presentation-api] Define postMessage behavior

Mozilla currently supports [this interface for 
messaging](https://bugzilla.mozilla.org/attachment.cgi?id=8527264&action=diff#a/dom/webidl/PresentationSocketChannel.webidl_sec1):

```
interface PresentationSession : EventTarget {
  <snip>
  readonly attribute PresentationSocketChannel channel;
};
```

```
interface PresentationSocketChannel : EventTarget {
17        [Throws]
18        void send (DOMString data);
19        [Throws]
20        void send (Blob data);
21        [Throws]
22        void send (ArrayBuffer data);
23        [Throws]
24        void send (ArrayBufferView data);
25      
26        void close ();
27      
28        attribute PresentationBinaryType binaryType;
29        readonly attribute unsigned long bufferedAmount;
30      
31        const unsigned short CONNECTING = 0;
32        const unsigned short OPEN = 1;
33        const unsigned short CLOSING = 2;
34        const unsigned short CLOSED = 3;
35        readonly attribute unsigned short readyState;
36      
37        attribute EventHandler onmessage;
38        attribute EventHandler onopen;
39        attribute EventHandler onerror;
40        attribute EventHandler onclose;
41      };
```

I like that the API supports multiple data types, but it seems to 
assume the underlying connection technology has the same semantics as 
[WebSockets](http://www.w3.org/TR/websockets/).

My questions for the Mozilla folks:

(1) What does it mean for the PresentationSession to be connected but 
the associated channel to be CLOSED?  Similarly what does it mean for 
the session to be disconnected but the channel != CLOSED?

(2) What if the connection technology between the user agents is 
connection-less (i.e. based on UDP or a push messaging service)?  What
 would the readyState or state transitions mean?

I would instead propose a simpler API that allows flexible data 
passing without making assumptions about the connection technology:

```
interface PresentationSession : EventTarget {
          [Throws]
          void send (DOMString data);

          [Throws]
          void send (Blob data);

          [Throws]
          void send (ArrayBuffer data);

          [Throws]
          void send (ArrayBufferView data);

          attribute EventHandler onmessage;
};
```




-- 
GitHub Notif of comment by mfoltzgoogle
See 
https://github.com/w3c/presentation-api/issues/46#issuecomment-75853487

Received on Tuesday, 24 February 2015 21:48:17 UTC