amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

Support viewer initiated handshake

Open cramforce opened this issue 9 years ago • 10 comments

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

cramforce avatar Dec 21 '16 15:12 cramforce

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 avatar Dec 21 '16 15:12 ericfs

@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.

cramforce avatar Dec 21 '16 15:12 cramforce

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.

ericfs avatar Dec 21 '16 16:12 ericfs

CC @dvoytenko who had some opinions about evolving the new viewer integration.

cramforce avatar Dec 21 '16 16:12 cramforce

I actually liked some aspects of the current PROD viewer integration. I'd rather we make steps to get closer to that handshake.

dvoytenko avatar Dec 21 '16 18:12 dvoytenko

Just leaving here: @dvoytenko mentioned this is also needed for Android web view messaging.

cramforce avatar Jan 11 '17 19:01 cramforce

https://github.com/ampproject/amphtml/pull/7173/

chenshay avatar Feb 08 '17 01:02 chenshay

@chenshay: Can this be closed?

jridgewell avatar Feb 14 '17 20:02 jridgewell

We have this working for webview. Now we want to make it work for iframes.

chenshay avatar Mar 02 '17 01:03 chenshay

cap=handshakepoll && isIframe

chenshay avatar Mar 02 '17 01:03 chenshay