-
Notifications
You must be signed in to change notification settings - Fork 8
Description
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?