finos / FDC3

An open standard for the financial desktop.
https://fdc3.finos.org
Other
201 stars 132 forks source link

Clarification re repeated addContextListener and addIntentListener calls #1394

Open kemerava opened 1 month ago

kemerava commented 1 month ago

Closes #1390

Based on the discussion on the issue, adding the clarification to the standard on the expected behavior when multiple calls are made to addContextListener and addIntentListener

@michael-bowen-sc

netlify[bot] commented 1 month ago

Deploy Preview for fdc3 failed. Why did it fail? →

Name Link
Latest commit 3acaa23fed8bf3048b95826d03c1e214e4f62c05
Latest deploy log https://app.netlify.com/sites/fdc3/deploys/671bb977940a6c00085cd744
bingenito commented 1 month ago

I see a mix of resolvererror and resolveerror in text and anchor links.

kriswest commented 1 month ago

I see a mix of resolvererror and resolveerror in text and anchor links.

Good 👀 @bingenito - I missed several of those. Added to suggestions

kemerava commented 4 weeks ago

Good job! Personally, I think that we triggering of all listeners is currently a MUST and should remain so (meaning the SHOULDs in the this PR become MUSTs to explicitly state that).

I also wonder if we need to add a comment about reconnection. If a web app is refreshed it needs to add new handlers as the old ones will be fone - the DA should be tracking the lifecycle of the app and considering them to have been removed if the app reloads/navigates/reconnects. That generally only applies to web apps as most others don't 'reconnect' or 'refresh' in a way that would wipe out their handler functions

@kriswest In terms of the reconnection, I think that there a case which can to be made for Desktop Agent to keep the listeners in memory at least for a short period of time. Not sure as much for web apps, but for others, depending on which method of connection is used, it is possible that the app temporarily lost the connection, and I am not sure if it makes sense to always ask apps to reconnect. This is my scenario, for example, if Desktop Agent is determining the app connection based on the heartbeats from the app, and then the app disconnects, then the behavior is slightly undererministic, where Desktop Agent might have already "noticed" that the app has disconnected, and removed the listeners, or it has not, and then the listeners are still there, and then the app unnecessarily sending more calls to DA. Of course, even with keeping listeners in memory we cannot guarantee for sure if that senario would not happen. We can also think about introducing an endpoint which would list all the listenerIds which DA has for the given app, this way the app can verify if it is missing some listeners or if there are some which are no longer needed and can be cleaned up Please let me know what you think!