Skip to content

Commit

Permalink
updates based on change requests
Browse files Browse the repository at this point in the history
  • Loading branch information
nkolba committed Jan 21, 2020
1 parent 41794ce commit 69aefec
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions docs/api/api-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ To find a system channel, one calls
```javascript
//returns an array of channels
let allChannels = await fdc3.getSystemChannels();
let redChannel = allChannels.find(c=>{return c.id === "red";});
let redChannel = allChannels.find(c => c.id === 'red');
```
#### Joining channels

To join a channel. one calls

Expand All @@ -170,14 +171,18 @@ To join a channel. one calls

Calling _fdc3.broadcast_ will now route context to the joined channel.

#### App Channels

App channels are topics dynamically created by applications connected via FDC3. For example, an app may create a channel to broadcast to others data or status specific to that app.

To get (or create) a channel reference, then interact with it

```javascript
const appChannel = await fdc3.getOrCreateChannel("appChannel");
const appChannel = await fdc3.getOrCreateChannel('my_custom_channel');
//get the current context of the channel
let current = await appChannel.getCurrentContext();
//add a listener
appChannel.addBroadcastListener((event)=>{...});
appChannel.addBroadcastListener(event => {...});
//broadcast to the channel
appChannel.broadcast(context);

Expand Down

0 comments on commit 69aefec

Please sign in to comment.