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

fdc3.joinChannel docs should explain expected behavior on joinChannel #418

Closed
kriswest opened this issue Jul 5, 2021 · 2 comments · Fixed by #454
Closed

fdc3.joinChannel docs should explain expected behavior on joinChannel #418

kriswest opened this issue Jul 5, 2021 · 2 comments · Fixed by #454
Assignees
Labels
api FDC3 API Working Group channels feeds & transactions Channels, Feeds & Transactions Discussion Group docs Documentation
Milestone

Comments

@kriswest
Copy link
Contributor

kriswest commented Jul 5, 2021

Area of Issue

[ ] App Directory
[ ] API
[ ] Context Data
[ ] Intents
[ ] Use Cases
[X] Other (documentation)

Issue Description:

The documentation for fdc3.joinChannel() does not clarify that the desktop agent should immediately call any context listeners already registered via fdc3.addContextListener with the current context as defined in the spec:

When an app joins a channel it will automatically recieve the current context for that channel.

This presumably implies the same behaviour as the Channel API's getCurrentContext function, where, if a type is passed the last context of that type broadcast on the channel is returned, rather than just the last context. However, this is not clarified in either the spec or documentation.

Both the specification and documentation should be updated to make the expected behaviour clear.

@kriswest kriswest added docs Documentation api FDC3 API Working Group channels feeds & transactions Channels, Feeds & Transactions Discussion Group labels Jul 5, 2021
@kriswest kriswest self-assigned this Jul 5, 2021
@pgn-vole
Copy link

pgn-vole commented Jul 7, 2021

There is also a lack of precision around ad-hoc channel listening. I suppose this scenario should follow the behavior of fdc3.addContextListener.

const redChannel = await fdc3.getOrCreateChannel('red')
redChannel.addContextListener(() => {
  // Am I getting called with the last broadcasted context straight away?
})

@kriswest kriswest modified the milestones: 2.0-candidates, 2.0 Jul 12, 2021
@kriswest
Copy link
Contributor Author

@pgn-vole We should definitely clarify the docs on that case too. I think the answer is no, your context listener will not get called right away. Rather you have to use the channel.getCurrentContext() function (https://fdc3.finos.org/docs/api/ref/Channel#getcurrentcontext) to manually retrieve it.

I believe that these differences in behavior are intentional (now that I know about them)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api FDC3 API Working Group channels feeds & transactions Channels, Feeds & Transactions Discussion Group docs Documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants