finos / FDC3

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

Question: How does DesktopAgentProxy remove event listener? #1315

Closed Roaders closed 3 months ago

Roaders commented 3 months ago

Question Area

Question

My DesktopAgentProxy is listening for ChannelChangedEvent. This event listener was setup using AddEventListenerRequest and AddEventListenerResponse messages. There doesn't seem to be any way to remove this event listener though. I would have expected there to be RemoveEventListenerRequest and RemoveEventListenerResponse

kriswest commented 3 months ago

Through the API fdc3.addEventListener returns a Listener object (as do addContextListener and addIntentListener). However, in the protocol we've given each listener its own message exchange for unsubscribe - but omitted one for the new event listeners.

I can go add a eventListenerUnsubscribeRequest and eventListenerUnsubscribeResponse - although a small voice is telling me we should perhaps be using a single exchange for all of these as they are all the same (payload is based on the listenerUUID).

@robmoffat @Roaders, any thoughts on that? Have a single message exchange for all instances of Listener.unsubscribe?

Roaders commented 3 months ago

From an implementation point of view it's probably going to be easier to have a separate message for each type of listener. Either that or have one message type but with a string union indicating what type of listener is being removed.

I think that I would prefer being able to tell which type of listener that I am removing rather than just relying on a listener ID and potentially needing an extra lookup to figure out what type it is.

Not too bothered though, either would be fine.

kriswest commented 3 months ago

This should do the job in that case: https://github.com/finos/FDC3/commit/f9fddc159404ca130f5335b9acc46290af92b370

If we want to unify these messages in future, I'm sure we could...