-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
147 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
how-to/workspace-platform-starter/docs/how-to-customize-your-interop-broker.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
> **_:information_source: OpenFin Workspace:_** [OpenFin Workspace](https://www.openfin.co/workspace/) is a commercial product and this repo is for evaluation purposes (See [LICENSE.MD](../LICENSE.MD)). Use of the OpenFin Container and OpenFin Workspace components is only granted pursuant to a license from OpenFin (see [manifest](../public/manifest.fin.json)). Please [**contact us**](https://www.openfin.co/workspace/poc/) if you would like to request a developer evaluation key or to discuss a production license. | ||
[<- Back to Table Of Contents](../README.md) | ||
|
||
# How To Customize Your Interop Broker | ||
|
||
Workspace Platform Starter includes a default [interop broker override](../client/src/framework/platform/broker/interop-override.ts) that includes support for FDC3 2.0 and intents as well as context. If has been built to support interop with support for the Platform Apps format used by Workspace Platform Starter (directories can still use the FDC3 1.2 & 2.0 format as these are mapped internally to the PlatformApp format). | ||
|
||
OpenFin Workspace 17.4+ lets you specify an array of interop overrides that can be layered on top of each other so that different overrides can add custom behavior. | ||
|
||
Workspace Platform Starter 17.4 supports this ability by adding two new settings to the platformProvider.interop settings. | ||
|
||
## moduleInheritance | ||
|
||
This setting lets you how we should treat the interop overrides defined in the modules array: | ||
|
||
- derived (default) - Your interop overrides will be derived from our default interop override and your modules will use our implementation as a base. | ||
- base - Your interop overrides will be the base class for our default interop override and when we call super we are calling your module implementations. | ||
- standalone - Your modules do not use our default implementation and will be responsible for InteropBroker functionality (extending from the default InteropBroker provided by the OpenFin Workspace Platform NPM Package) | ||
|
||
```json | ||
"platformProvider": { | ||
... | ||
"interop": { | ||
"moduleInheritance": "derived" | ||
} | ||
} | ||
``` | ||
|
||
## modules | ||
|
||
These are interop modules that provide custom interop broker logic. If there are more than one then they will extend each other (the earlier entries will act as the base for subsequent entries). By default the first module (and subsequently the ones that follow) will use our default interop override as a base (this can be configured as described above through the module inheritance). | ||
|
||
```json | ||
"platformProvider": { | ||
... | ||
"interop": { | ||
"modules": [ | ||
{ | ||
"enabled": true, | ||
"id": "my-interop-override", | ||
"url": "http://localhost:8080/js/modules/interop-override/my-interop-override.bundle.js", | ||
"data": { | ||
"customSetting": "a custom setting that will be passed to the interop override module for use" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
|
||
- Also added the option of changing when/if the Workspace Platform Starter default interop override runs: | ||
- after (default) - run the Workspace Platform Starter default broker implementation after your interop override modules (so the default implementation is the base class) | ||
- before - run the Workspace Platform Starter default broker implementation before your interop override modules (so your interop overrides are the base class for our default implementation) | ||
- never - never use the Workspace Platform Starter default implementation (So you will be responsible for adding full interop broker support through your modules) | ||
|
||
## Analytics Provider | ||
|
||
You can configure where analytics should be sent by using our Analytics Provider. You can then specify 1 or more modules (see [how to add a module](./how-to-add-a-module.md)) that will receive the analytic events and any config you specify. We have created a [console analytics module](../client/src/modules/analytics/console/) and configured it in [manifest.fin.json](../public/manifest.fin.json) and [second.manifest.fin.json's settings.json file](../public/settings.json). It isn't configured in our [third.manifest.fin.json](../public/third.manifest.fin.json) to show that this is an optional feature. | ||
|
||
```json | ||
"analyticsProvider": { | ||
"modules": [ | ||
{ | ||
"enabled": true, | ||
"id": "analytics.console", | ||
"url": "http://localhost:8080/js/modules/analytics/console.bundle.js", | ||
"data": { | ||
"eventLogLevel": "info" | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
|
||
## Platform Override | ||
|
||
We call the analytics provider from the [platform override](../client/src/framework/platform/platform-override.ts) file: | ||
|
||
```javascript | ||
public async handleAnalytics(events: AnalyticsEvent[]) { | ||
// we call the analytics provider from here and pass the events generated by the workspace components. | ||
} | ||
``` | ||
|
||
## Generate From Template | ||
|
||
You can generate the scaffold for a new module by using the following command line, where "My Analytics" is the name you want to give your module: | ||
|
||
```shell | ||
npm run generate-module analytics "My Analytics" | ||
``` | ||
|
||
This will generate the code in the modules/analytics folder, add an entry into webpack to build it, and add it to the manifest so that the module is loaded. | ||
|
||
## Source Reference | ||
|
||
- [Analytics](../client/src/framework/analytics.ts) | ||
- [PlatformAnalyticsEvent](../client/src/framework/shapes/analytics-shapes.ts) | ||
- [Console Analytics Module](../client/src/modules/analytics/console/) | ||
- [Platform Override](../client/src/framework/platform/platform-override.ts) | ||
|
||
[<- Back to Table Of Contents](../README.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,7 +152,8 @@ | |
"contexts": ["fdc3.instrument"] | ||
} | ||
] | ||
} | ||
}, | ||
"modules": [] | ||
} | ||
}, | ||
"appProvider": { | ||
|