Support viewer initiated handshake
Add a feature to viewer integration where:
- everything stays the same, but
- if the handshake never succeeded and the doc receives a message with data
amp-handshake-start - and the original handshake hasn't yet timed out
- restart the handshake
When you say that data is amp-handshake-start, you mean Event.data not the payload field of the message format?
https://github.com/ampproject/amphtml/blob/a1488ca593d5ee9d781de3c6d9663b1719ff497d/extensions/amp-viewer-integration/0.1/messaging.js#L123
@ericfs Good question. Should we just do a bare message? It might make the state machine with requestIds, etc. simpler in that it always starts with the document initiated handshake.
Don't feel strongly, though.
That's fine. It looks like that's what you're already doing with amp-handshake-request. We'll need to update the Viewer messaging to do the same, but I think it is reasonable.
CC @dvoytenko who had some opinions about evolving the new viewer integration.
I actually liked some aspects of the current PROD viewer integration. I'd rather we make steps to get closer to that handshake.
Just leaving here: @dvoytenko mentioned this is also needed for Android web view messaging.
https://github.com/ampproject/amphtml/pull/7173/
@chenshay: Can this be closed?
We have this working for webview. Now we want to make it work for iframes.
cap=handshakepoll && isIframe