[whatwg] postMessage() issues

On Wed, Apr 16, 2008 at 3:17 PM, Jonas Sicking <jonas at sicking.cc> wrote:

> - Processing a reply synchronously is awkward in any case, since you need
> > a callback.
> >
>
> I'm not sure I follow this argument, I actually come to the opposite
> conclusion.
>
> Say that a page is communicating with multiple iframes using
> postMessage, and expect replies from all of them.


I think the argument assumed you were communicating with a single frame in
the common case, in which case the current API is more awkward than one in
which the postMessage() call itself returns the response, requiring no
listener at all.

- This is different from event dispatch because replies are expected to be
> > common; two way communication channels like postMessage make more sense as
> > asynchronous, while event dispatch is typically one-way.
> >
>
> Why does two-way communication make more sense asynchronous? See above for
> why responses are more complicated with async communication.


>From one of Aaron Boodman's mails: if you're doing a postMessage() response
back to a frame when it calls you, then the original frame will get called
with your response before its original postMessage() actually returns.  This
nesting feels bizarre compared to a more linear "I send a message, then I
get a response" flow.

PK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20080416/8e144de5/attachment.htm>

Received on Wednesday, 16 April 2008 16:17:42 UTC