Skip to content
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

Fetch can potentially wait forever with no response #1

Open
chipbell4 opened this issue Feb 20, 2018 · 0 comments
Open

Fetch can potentially wait forever with no response #1

chipbell4 opened this issue Feb 20, 2018 · 0 comments

Comments

@chipbell4
Copy link
Contributor

I noticed an issue in fetch where a client could request data from the other side of an iframe but never receive a response. A quick code example:

// in the outer frame
var bellhop = new Bellhop();
bellhop.connect();
bellhop.fetch('ping', e => console.log('Received', e.data));
// in the inner frame
var bellhop = new Bellhop();
bellhop.connect();
// bellhop.respond('ping', 'pong')

In this case, the callback will never be called. This to me makes sense because it's asking the other side "if you have data, please provide", rather than "I need this data in order to move forward". However, I can see a case (UserData in springroll core for example), where it might be useful for the requestor to know if there isn't anyone listening on the other side so the app can respond accordingly.

The solution in my mind is to potentially add a timeout before eventually rejecting the event. However, I don't see any mechanism through the callback system to notify the requestor that it was an error, rather than an "real" response from the other side. What would be the correct approach?

wrbright added a commit that referenced this issue Sep 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant