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

544 Desktop Agent Bridging #968

Merged
merged 126 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from 56 commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
17d170c
adding bridging spec to fresh branch
kriswest Nov 23, 2022
a55c8d4
Clarify generation of responseGuid for collated messages, add message…
kriswest Nov 23, 2022
4368c32
Adding `meta.errorDetails` array to collate error messages, BridgingE…
kriswest Nov 23, 2022
939c29b
change in website dir to trigger preview generation
kriswest Nov 23, 2022
9d07e88
Fixed typos
Nov 23, 2022
65c701b
proposal update
Jan 24, 2023
01a4cb8
fix type definition
Feb 22, 2023
d0b5e5f
Adding schemas for types
Feb 24, 2023
a57f286
Merge branch 'master' into 544-Desktop-Agent_bridging-Proposal-mk2
Mar 21, 2023
ccf4965
Merge remote-tracking branch 'upstream/master' into 544-Desktop-Agent…
kriswest Apr 19, 2023
e192658
add support for mermaid diagrams to website
kriswest Apr 19, 2023
86e8f28
breakout message exchange in reference pages
kriswest Apr 19, 2023
f7c5995
Merge remote-tracking branch 'upstream/quicktype-update' into 544-Des…
kriswest Apr 20, 2023
c02a9ea
Updated front page icons and added bridging icon
kriswest Apr 20, 2023
19ab450
update cpy-cli version to resolve vulnerable dep
kriswest Apr 21, 2023
dcd68fe
Merge remote-tracking branch 'upstream/master' into 544-Desktop-Agent…
kriswest Apr 21, 2023
2bcea49
Adjust markdown linting rules and apply fixes to API docs where needed
kriswest Apr 24, 2023
6c30424
more minor linting fixes
kriswest Apr 24, 2023
2837ffe
Add a UUID standard reference to docs (referred to in bridging spec)
kriswest Apr 24, 2023
42c3da2
Add missing theme for mermaid diagrams to website/package.json
kriswest Apr 24, 2023
654935a
Integrate new error details into api spec and api-bridging reference …
kriswest Apr 24, 2023
b9e950f
Adding new terms and acronyms for bridging to glossary
kriswest Apr 24, 2023
b4e50fc
adjusting TODOs in spec
kriswest Apr 24, 2023
ae809b9
adding a missing error and adjusting TODOs
kriswest Apr 24, 2023
3662f73
Adding new errors to API sources
kriswest Apr 24, 2023
b35f7a1
Adding bridging errors, DesktopAgentIdentifier to API specs and sources
kriswest Apr 24, 2023
1b2e110
Comment cleanup
kriswest Apr 24, 2023
d7c2251
Update details on inter-agent communication
kriswest Apr 24, 2023
6830c73
Experimental flags + improving some comments
kriswest Apr 25, 2023
37d2f53
new schema structure (#65)
tpina Apr 25, 2023
4fad1f7
correcting payloads on a couple of PrivateChannel messages
kriswest Apr 25, 2023
fd5cdcb
Refining request destinations
kriswest Apr 25, 2023
7e519fc
added private channel schemas
Apr 25, 2023
74eec20
Export BridgingTypes for NPM module
kriswest Apr 25, 2023
4d2c9a4
Correct schema links in all context docs pages
kriswest Apr 25, 2023
969e705
Add notes on generated sources to bridging spec
kriswest Apr 25, 2023
478d80e
Adding schema links to bridging ref docs + corrections
kriswest Apr 25, 2023
c93d371
Refactor bridging proposal structure to separate connection and proto…
kriswest Apr 25, 2023
1b4896a
Reassemble connection section of bridging proposal
kriswest Apr 25, 2023
6b0bfdc
commenting out TODO list
kriswest Apr 25, 2023
a5aa387
tweaking port range details
kriswest Apr 25, 2023
99e3385
Merge remote-tracking branch 'upstream/master' into 544-Desktop-Agent…
kriswest Apr 25, 2023
1d5492b
Fixing broken links
kriswest Apr 25, 2023
9487744
Fixing Methods.ts tests
kriswest Apr 25, 2023
e82492f
Linting Methods.test.ts
kriswest Apr 25, 2023
05549fb
adjusting netlify config
kriswest Apr 25, 2023
ba539f4
Adding schema links for bridgeRequest and bridgeResponse
kriswest Apr 26, 2023
5289bcd
Avoid Prettier issue with `export * as`
kriswest Apr 26, 2023
ccc6bc5
connection protocol schemas
Apr 26, 2023
f98ea83
Updating TODO list
kriswest Apr 26, 2023
112f0a2
Merge branch 'master' into 544-Desktop-Agent_bridging-Proposal-mk2
kriswest Apr 26, 2023
a743042
Fix typo in PrivateChannel.eventListenerRemoved
kriswest Apr 26, 2023
e6165ad
Added descriptions to connection protocol schemas
Apr 26, 2023
6f7ef60
Merge branch '544-Desktop-Agent_bridging-Proposal-mk2' of https://git…
Apr 26, 2023
4468ed4
Tweaking content of multi-machine sections of bridging spec
kriswest Apr 26, 2023
ed2ea76
Merge branch '544-Desktop-Agent_bridging-Proposal-mk2' of https://git…
kriswest Apr 26, 2023
13f7f14
Feedback from review
kriswest May 2, 2023
763aed9
fixing a missing word in bridging spec
kriswest May 2, 2023
63d728b
Review comment: Clarifying expected behavior in raiseIntent message e…
kriswest May 2, 2023
c798b41
Fixing minor syntax error in documentation example
kriswest May 3, 2023
c50bf90
Review comments: Shorthand change from API Bridging -> Agent Bridging
kriswest May 3, 2023
127c059
Improve structure of raiseIntent ref page
kriswest May 4, 2023
86a7374
npm audit fix (yanl vulnerability)
kriswest May 15, 2023
2997a7d
Add missing intent field to raiseIntentRequest
kriswest May 15, 2023
57c566c
ImplementationMetadata split
May 16, 2023
46a45ac
544 Improve dab overview (#66)
kriswest May 24, 2023
4c66d99
correction to DAB step 3 example
kriswest May 24, 2023
5d5c31b
label ImplementationMetadata
kriswest May 24, 2023
f09575b
Correct reference to a late step in connection sequence
kriswest May 24, 2023
c60e7cc
Merge remote-tracking branch 'upstream/master' into 544-Desktop-Agent…
kriswest May 31, 2023
5e81c98
prettier
kriswest May 31, 2023
c2ace9c
Merge branch 'master' into 544-Desktop-Agent_bridging-Proposal-mk2
kriswest May 31, 2023
1a31664
Switch from GUID to UUID (#67)
kriswest Jun 7, 2023
37b6654
Merge remote-tracking branch 'upstream/master' into 544-Desktop-Agent…
kriswest Jun 9, 2023
66fda58
544 refactor schemas to separate agent and bridge messages (#69)
kriswest Jun 14, 2023
d73b960
schema names openAgentRequest openBridgeRequest
Jun 15, 2023
ed05dc3
Merge branch 'master' into 544-Desktop-Agent_bridging-Proposal-mk2
kriswest Jun 29, 2023
c9f772d
Improving Bridging schemas based on feedback (#70)
kriswest Jul 12, 2023
4375bd6
Fixing channel args to broadcast in bridging schemas and changing fie…
kriswest Jul 17, 2023
9ae707e
Merge pull request #73 from InteropIO/Fix-channel-arguments-in-broadcast
tpina Jul 17, 2023
7fcdc16
Adding separate schemas for error responses in order to provide preci…
kriswest Jul 17, 2023
ee09ec2
Adding updated async API schema for bridging
kriswest Jul 17, 2023
066e268
minor tweaks to aysnc API comments + sorting messages
kriswest Jul 17, 2023
e7f310f
Adding agent error response schema links to docs
kriswest Jul 17, 2023
10fd794
Adding error responses from bridge for cases where all agents errored
kriswest Jul 17, 2023
403289c
Adding a MalformedMessage error to BridgingError and comments to API …
kriswest Jul 17, 2023
bfc100f
Bug fixes (#74)
tpina Jul 17, 2023
fc90cc1
regenerate BridgingTypes.ts and copy schemas to website
kriswest Jul 17, 2023
4a36deb
prettier
kriswest Jul 17, 2023
d52a509
Merge remote-tracking branch 'upstream/master' into 544-Desktop-Agent…
kriswest Jul 18, 2023
2a5ba33
improve labelling of schema links
kriswest Jul 18, 2023
ebf97b1
Update .semgrepignore
kriswest Jul 18, 2023
3e09a99
Merge remote-tracking branch 'upstream/master' into 544-Desktop-Agent…
kriswest Jul 18, 2023
be527e6
migrating new context schemas to schemas folder
kriswest Jul 18, 2023
6bb5028
clean up duplication in references
kriswest Jul 18, 2023
5aca58b
Update bridging type generation README.md
kriswest Jul 18, 2023
0385be1
small cleanup (#75)
tpina Jul 18, 2023
4b09896
Adding clarification to SCOPE.md
kriswest Jul 18, 2023
c452ba3
Merge branch '544-Desktop-Agent_bridging-Proposal-mk2' of https://git…
kriswest Jul 18, 2023
018108d
findIntent fix (#76)
tpina Jul 18, 2023
bfbffb5
Merge remote-tracking branch 'upstream/master' into 544-Desktop-Agent…
kriswest Jul 19, 2023
499e5bb
update readme for bridging
kriswest Jul 19, 2023
d584d51
context is options in findIntent (#77)
tpina Jul 19, 2023
37decfd
response messages don't need a source field
kriswest Jul 19, 2023
2c5777e
Merge pull request #78 from InteropIO/544-remove-source-from-responses
tpina Jul 19, 2023
152f7ea
fixed typo (#79)
tpina Jul 20, 2023
01385d5
Adding missing sources element to getAppMetadata bridge response in docs
kriswest Jul 21, 2023
1c50b9e
reoving meta.sources from raiseIntentResultResponse docs to match schema
kriswest Jul 21, 2023
894ab62
Further refining schemas to improve naming in generated code
kriswest Jul 21, 2023
d3926f2
ENsuring desktopAgent is required on getAppMetadata payload as we mus…
kriswest Jul 21, 2023
0cd58f5
comment
kriswest Jul 21, 2023
eeaa75b
adding note that apps don't need to do anything special to use bridging
kriswest Jul 24, 2023
c3ed1b4
Adding agent bridging to FDC3 abstract page
kriswest Jul 25, 2023
cb6ff38
updating comments in docs that mention 4, rather than 5 parts to FDC3
kriswest Jul 25, 2023
f9e4cdf
Markdown lint in readme
kriswest Jul 25, 2023
d02ff54
Merge remote-tracking branch 'upstream/master' into 544-Desktop-Agent…
kriswest Jul 25, 2023
14d1277
Apply suggestions from code review
kriswest Jul 26, 2023
959d8b4
Correcting schema ids on new context schemas
kriswest Jul 26, 2023
2816e3a
Merge branch 'master' into 544-Desktop-Agent_bridging-Proposal-mk2
kriswest Jul 26, 2023
0b481f0
Apply suggestions from code review
kriswest Jul 26, 2023
a6fb49b
Add the app to each reference page mermaid diagram to clarify how mes…
kriswest Jul 26, 2023
fd9eef4
Fixing build issue and copying schemas to website
kriswest Jul 26, 2023
870f542
Fixing minor issue in raiseIntentResult bridging schema so that it ca…
kriswest Jul 26, 2023
6160f53
Fixing broken links in a few docs
kriswest Jul 26, 2023
cd42543
npm audit fixes
kriswest Jul 26, 2023
682d287
Regenerating bridging types
kriswest Jul 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/.markdownlint.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
//Disabled as we often use manual H1 heading for reference pages,
// where the markdown metadata is picked up as the top level heading
"single-h1": false,
//Many lines in md files are longer than 80 chars
"line-length": false,
//We have repeated headings, like 'Properties' or 'Fields' in reference docs.
"no-duplicate-header": {
"siblings_only": true
}
}
85 changes: 85 additions & 0 deletions docs/api-bridging/ref/PrivateChannel.broadcast.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
id: PrivateChannel.broadcast
sidebar_label: PC.broadcast
title: PrivateChannel.broadcast
---

Desktop Agent bridging message exchange for a `broadcast` API call on a [`PrivateChannel`](../../api/ref/PrivateChannel). Generated by API calls:

* [`PrivateChannel.broadcast(context: Context)`](../../api/ref/Channel#broadcast) (inherited from the [Channel](../../api/ref/Channel#broadcast) class)

[Message Exchange Type](../spec#individual-message-exchanges): **Request only**

:::caution

Some additional tracking of PrivateChannel metadata is required on the Desktop Agent that created each PrivateChannel and on any Desktop Agent interacting with it, in order to use these message exchanges. Please see the [relevant section of the API Bridging overview](../spec#privatechannels) for more details.

:::

## Message exchange

```mermaid
sequenceDiagram
participant DA as Desktop Agent A
participant DAB as Desktop Agent Bridge
participant DB as Desktop Agent B
participant DC as Desktop Agent C
DA ->>+ DAB: PrivateChannel.broadcast
DAB ->>+ DB: PrivateChannel.broadcast
```

## Request format

### Schema

[https://fdc3.finos.org/schemas/next/bridging/privateChannelBroadcast.schema.json](/schemas/next/bridging/privateChannelBroadcast.schema.json)

### Example

```javascript
fdc3.addIntentListener("QuoteStream", async (context) => {
const privateChannel: PrivateChannel = await fdc3.createPrivateChannel();
const symbol = context.id.ticker;

// This gets called when the remote side adds a context listener
const addContextListener = privateChannel.onAddContextListener((contextType) => {
// broadcast price quotes as they come in from our quote feed
feed.onQuote(symbol, (price) => {
privateChannel.broadcast({ type: "price", price});
});
});

...

return channel;
});
```

Broadcast messages that are sent from Agents that received the private channel from a remote agent are sent to the Desktop Agent that created the channel and returned it as an `IntentResult`, which is responsible for forwarding them onto other subscribers. If a broadcast message is generated on the Agent that created the channel it simply forwards it onto each subscriber.

Hence, the broadcast message should be repeated once for each subscriber, and modified such that it includes a destination, specified as a full `AppIdentifier`, and the `type` should indicate that it is a `PrivateChannel` broadcast:

```json
// DAB -> agent-B
{
"type": "PrivateChannel.broadcast", //modified type for PrivateChannel broadcasts
"payload": {
"channel": "private-channel-ABC123",
"context": { /*contextObj*/}
},
"meta": {
"requestGuid": "<requestGuid>",
"timestamp": "2020-03-...",
"source": {
"appId": "AChatApp",
"instanceId": "02e575aa-4c3a-4b66-acad-155073be21f6",
"desktopAgent": "agent-A" //added by DAB
},
"destination": {
"appId": "AnotherApp",
"instanceId": "02e235ba-acad-4b66-4c3a-547073be23f1",
"desktopAgent": "agent-B"
}
}
}
```
66 changes: 66 additions & 0 deletions docs/api-bridging/ref/PrivateChannel.eventListenerAdded.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
id: PrivateChannel.eventListenerAdded
sidebar_label: PC.eventListenerAdded
title: PrivateChannel.eventListenerAdded
---

Desktop Agent bridging message exchange for the addition of an event handler to a [`PrivateChannel`](../../api/ref/PrivateChannel). Generated by API calls:

* [`PrivateChannel.onAddContextListener(handler: (contextType?: string) => void)`](../../api/ref/PrivateChannel#onaddcontextlistener)
* [`PrivateChannel.onUnsubscribe(handler: (contextType?: string) => void)`](../../api/ref/PrivateChannel#onunsubscribe)
* [`PrivateChannel.onDisconnect(handler: () => void)`](../../api/ref/PrivateChannel#ondisconnect)

[Message Exchange Type](../spec#individual-message-exchanges): **Request only**

:::caution

Some additional tracking of PrivateChannel metadata is required on the Desktop Agent that created each PrivateChannel and on any Desktop Agent interacting with it, in order to use these message exchanges. Please see the [relevant section of the API Bridging overview](../spec#privatechannels) for more details.

:::

Private channels support a number of additional event listeners (`onAddContextListener`, `onUnsubscribe`, `onDisconnect`), when an application adds one of these event listeners to a private channel that was created remotely and returned as an `IntentResult` (which should be tracked by the Desktop Agent Bridge client) a message needs to be sent to the agent that created the channel to facilitate routing of event messages. A single message type is used for this with a `payload.listenerType` field.

## Message exchange

```mermaid
sequenceDiagram
participant DA as Desktop Agent A
participant DAB as Desktop Agent Bridge
participant DB as Desktop Agent B
participant DC as Desktop Agent C
DA ->>+ DAB: PrivateChannel.eventListenerAdded
DAB ->>+ DB: PrivateChannel.eventListenerAdded
```

## Request format

### Schema

[https://fdc3.finos.org/schemas/next/bridging/privateChannelEventListenerAdded.schema.json](/schemas/next/bridging/privateChannelEventListenerAdded.schema.json)

### Example

```json
// agent-A -> DAB
{
"type": "PrivateChannel.eventListenerAdded",
"payload": {
"channel": "private-channel-ABC123",
"listenerType": "onAddContextListener"
},
"meta": {
"requestGuid": "<requestGuid>",
"timestamp": "2020-03-...",
"source": {
"appId": "AChatApp",
"instanceId": "02e575aa-4c3a-4b66-acad-155073be21f6",
"desktopAgent": "agent-A" //added by DAB
},
"destination": {
"appId": "AnotherApp",
"instanceId": "02e235ba-acad-4b66-4c3a-547073be23f1",
"desktopAgent": "agent-B"
}
}
}
```
69 changes: 69 additions & 0 deletions docs/api-bridging/ref/PrivateChannel.eventListenerRemoved.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
id: PrivateChannel.eventListenerRemoved
sidebar_label: PC.eventListenerRemoved
title: PrivateChannel.eventListenerRemoved
---

Desktop Agent bridging message exchange for the removal of an event handler from a [`PrivateChannel`](../../api/ref/PrivateChannel). Generated by API calls:

* [`listener.unsubscribe()`](../../api/ref/Types#listener)
* for [`Listener`](../../api/ref/Types#listener) objects returned by [`PrivateChannel`](../../api/ref/PrivateChannel) functions:
* [`onAddContextListener(handler: (contextType?: string)`](../../api/ref/PrivateChannel#onaddcontextlistener)
* [`onUnsubscribe(handler: (contextType?: string) => void)`](../../api/ref/PrivateChannel#onunsubscribe)
* [`onDisconnect(handler: () => void)`](../../api/ref/PrivateChannel#ondisconnect)
* [`PrivateChannel.disconnect()`](../../api/ref/PrivateChannel#disconnect)

[Message Exchange Type](../spec#individual-message-exchanges): **Request only**

:::caution

Some additional tracking of PrivateChannel metadata is required on the Desktop Agent that created each PrivateChannel and on any Desktop Agent interacting with it, in order to use these message exchanges. Please see the [relevant section of the API Bridging overview](../spec#privatechannels) for more details.

:::

Private channels support a number of additional event listeners (`onAddContextListener`, `onUnsubscribe`, `onDisconnect`), when an application removes an event listener from a PrivateChannel that was created remotely and returned as an `IntentResult` (which should be tracked by the Desktop Agent Bridge client) a message needs to be sent to the agent that created the channel so it can discard retained routing information. A single message type is used for this with a `payload.listenerType` field.

## Message exchange

```mermaid
sequenceDiagram
participant DA as Desktop Agent A
participant DAB as Desktop Agent Bridge
participant DB as Desktop Agent B
participant DC as Desktop Agent C
DA ->>+ DAB: PrivateChannel.eventListenerRemoved
DAB ->>+ DB: PrivateChannel.eventListenerRemoved
```

## Request format

### Schema

[https://fdc3.finos.org/schemas/next/bridging/privateChannelEventListenerRemoved.schema.json](/schemas/next/bridging/privateChannelEventListenerRemoved.schema.json)

### Example

```json
// agent-A -> DAB
{
"type": "PrivateChannel.eventListenerRemoved",
"payload": {
"channel": "private-channel-ABC123",
"listenerType": "onAddContextListener"
},
"meta": {
"requestGuid": "<requestGuid>",
"timestamp": "2020-03-...",
"source": {
"appId": "AChatApp",
"instanceId": "02e575aa-4c3a-4b66-acad-155073be21f6",
"desktopAgent": "agent-A" //added by DAB
},
"destination": {
"appId": "AnotherApp",
"instanceId": "02e235ba-acad-4b66-4c3a-547073be23f1",
"desktopAgent": "agent-B"
}
}
}
```
64 changes: 64 additions & 0 deletions docs/api-bridging/ref/PrivateChannel.onAddContextListener.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
id: PrivateChannel.onAddContextListener
sidebar_label: PC.onAddContextListener
title: PrivateChannel.onAddContextListener
---

Desktop Agent bridging message exchange for the addition of a [`ContextHandler`](../../api/ref/Types#contexthandler) to a [`PrivateChannel`](../../api/ref/PrivateChannel). Generated by API call:

* [`PrivateChannel.addContextListener(contextType: string | null, handler: ContextHandler)`](../../api/ref/Channel#addcontextlistener) (inherited from `Channel`)

[Message Exchange Type](../spec#individual-message-exchanges): **Request only**

:::caution

Some additional tracking of PrivateChannel metadata is required on the Desktop Agent that created each PrivateChannel and on any Desktop Agent interacting with it, in order to use these message exchanges. Please see the [relevant section of the API Bridging overview](../spec#privatechannels) for more details.

:::

When a `ContextListener` is added to a `PrivateChannel` any applications that have added an `onAddContextListener` handler MUST be notified. If the listener is on the agent that created that channel, it should forward the message onto all the registered listeners. If the listener is added on a remote agent it MUST send the message to the agent that created the channel which will repeat it onto the other listeners without modifying the source information.

## Message exchange

```mermaid
sequenceDiagram
participant DA as Desktop Agent A
participant DAB as Desktop Agent Bridge
participant DB as Desktop Agent B
participant DC as Desktop Agent C
DA ->>+ DAB: PrivateChannel.onAddContextListener
DAB ->>+ DB: PrivateChannel.onAddContextListener
```

## Request format

### Schema

[https://fdc3.finos.org/schemas/next/bridging/privateChannelOnAddContextListener.schema.json](/schemas/next/bridging/privateChannelOnAddContextListener.schema.json)

### Example

```json
// agent-A -> DAB
{
"type": "PrivateChannel.onAddContextListener",
"payload": {
"channel": "private-channel-ABC123",
"contextType": "fdc3.instrument"
},
"meta": {
"requestGuid": "<requestGuid>",
"timestamp": "2020-03-...",
"source": {
"appId": "AnotherApp",
"instanceId": "02e235ba-acad-4b66-4c3a-547073be23f1",
"desktopAgent": "agent-B" //added by DAB
},
"destination": {
"appId": "AChatApp",
"instanceId": "02e575aa-4c3a-4b66-acad-155073be21f6",
"desktopAgent": "agent-A"
}
}
}
```
63 changes: 63 additions & 0 deletions docs/api-bridging/ref/PrivateChannel.onDisconnect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
id: PrivateChannel.onDisconnect
sidebar_label: PC.onDisconnect
title: PrivateChannel.onDisconnect
---

Desktop Agent bridging message exchange for a `disconnect()` API call on [`PrivateChannel`](../../api/ref/PrivateChannel). Generated by API call:

* [`PrivateChannel.disconnect()`](../../api/ref/PrivateChannel#disconnect)

[Message Exchange Type](../spec#individual-message-exchanges): **Request only**

:::caution

Some additional tracking of PrivateChannel metadata is required on the Desktop Agent that created each PrivateChannel and on any Desktop Agent interacting with it, in order to use these message exchanges. Please see the [relevant section of the API Bridging overview](../spec#privatechannels) for more details.

:::

When the `disconnect` function is is called on a `PrivateChannel` any applications that have added an `onDisconnect` handler or an `onUnsubscribe` handler (which is automatically called when an application disconnects) MUST be notified. If the listener is on the agent that created that channel, it should forward the message onto all the registered listeners. If the listener is added on a remote agent it MUST send the message to the agent that created the channel which will repeat it onto the other listeners without modifying the source information. If the `PrivateChannel` was created by a remote agent, only the single `PrivateChannel.onDisconnect` is required. It is the responsibility of the Desktop Agent that created the channel to ensure that any relevant `onUnsubscribe` handlers are also called by sending additional `PrivateChannel.onUnsubscribe` messages to them before forwarding the `PrivateChannel.onDisconnect`. This applies whether the disconnection occurred on that agent or on a remote agent.

## Message exchange

```mermaid
sequenceDiagram
participant DA as Desktop Agent A
participant DAB as Desktop Agent Bridge
participant DB as Desktop Agent B
participant DC as Desktop Agent C
DA ->>+ DAB: PrivateChannel.onDisconnect
DAB ->>+ DB: PrivateChannel.onDisconnect
```

## Request format

### Schema

[https://fdc3.finos.org/schemas/next/bridging/privateChannelOnDisconnect.schema.json](/schemas/next/bridging/privateChannelOnDisconnect.schema.json)

### Example

```json
// agent-A -> DAB
{
"type": "PrivateChannel.onDisconnect",
"payload": {
"channel": "private-channel-ABC123"
},
"meta": {
"requestGuid": "<requestGuid>",
"timestamp": "2020-03-...",
"source": {
"appId": "AnotherApp",
"instanceId": "02e235ba-acad-4b66-4c3a-547073be23f1",
"desktopAgent": "agent-B" //added by DAB
},
"destination": {
"appId": "AChatApp",
"instanceId": "02e575aa-4c3a-4b66-acad-155073be21f6",
"desktopAgent": "agent-A"
}
}
}
```
Loading