-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement message channel #56
Conversation
); | ||
addDOMEventListeners(); | ||
|
||
TKHQ.sendMessageUp("PUBLIC_KEY_READY", targetPubHex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm worried that if this sendMessageUp
function is called before TURNKEY_INIT_MESSAGE_CHANNEL
is received (and thus, the channel set up), then the message will fail to be received on the other end (parent frame) because new SDKs won't listen for raw messages coming from postMessage anymore.
So it seems there's a bit of a race condition, and we should wait to receive "TURNKEY_INIT_MESSAGE_CHANNEL" before broadcasting "PUBLIC_KEY_READY"?
Another way to handle this is to broadcast PUBLIC_KEY_READY
twice:
- leave this here the way you have it (for old SDKs)
- add a call to
sendMessageUp("PUBLIC_KEY_READY", targetPubHex)
again right afterTKHQ.setParentFrameMessageChannelPort
is called (so that new SDKs receive it as well)
Now that I'm writing this I think that's probably the cleanest option?
No description provided.