finos/FDC3-conformance-framework

Do NOT use joinChannel on App Channels

Closed this issue · 2 comments

@Joe-Dunleavy @osouthwell-scottlogic @robmoffat The 1.2 open tests are still using fdc3.joinChannel calls for app channels - as previously discussed you must use fdc3.getOrCreateChannel on app channels NOT fdc3.joinChannel:

await fdc3.joinChannel("FDC3-Conformance-Channel");

and your receiver needs to use the channel object NOT the top level fdc3.addContextListener (which is for user/system channels):

const listener = fdc3.addContextListener(contextType, (context) => {

You'll need to fix this both in the test definition and the mock apps (which still contain JS in a script tag):

window.fdc3.joinChannel("FDC3-Conformance-Channel").then(() => {
// broadcast that this app has opened
window.fdc3.broadcast({
type: "fdc3-conformance-opened",
});
// Context listeners used by tests.
window.fdc3.addContextListener("fdc3.testReceiver", (context) => {
// broadcast that this app has received context
window.fdc3.broadcast({
type: "fdc3-conformance-context-received",
context: context,
});
});
window.fdc3.addContextListener("fdc3.testReceiverMultiple", (context) => {
// broadcast that this app has received context
window.fdc3.broadcast({
type: "fdc3-conformance-context-received-multiple",
context: context,
});
});
});

This applies to both 1.2 and 2.0 mock apps (I've only provided references for 1.2)

This PR resolves this in both 1.2 and 2.0: #140

resolved