Directories
Directories help you segment and separate your applications. In many ways, they reflect folder systems, where user groups may have permission to a certain set of applications. Here we use directories for the following reasons:
- Restrict application communication: Ensure applications can communicate to one another, securely. This prevents external apps from communicating to authorised applications when they shouldn't.
- Team specific applications: Teams can use widely different applications. This enables you to create groups of applications refective of internal team usage.
- Development Environments: Folders can reflect development environments, such as development, staging, testing or prod.
Creating Directories
With Connectifi, applications interoperate by connecting to the same directory. The directory determines what applications can participate and defines the security parameters. Applications and their mappings to contexts and intents are all defined within a directory.
To create a directory:
- Sign into the Connectifi admin UI at https://platform.connectifi.app (opens in a new tab). If you have an enterprise instance of Connectifi, a custom URL is created for your environment, typically:
account_name
.connectifi.app. - Click on the 'Directories' in the Left hand nav. Here you will be presented with a grid or list view of all of your directories.
- Click on 'Create Directory', in order to create a new directory.
- Begin filling in the name and description of the directory to determine the objective of the directory.
- Add your directories logo. We recommend a 256x256 png.
- The “Interop Strategy” setting determines the security and access model for the directory
- Open: Any applications can connect to the directory
- Open+Auth: Any application can connect to the directory, but the user needs to be logged into Connectifi to connect to the directory.
- App: Only applications registered in the directory can connect to the directory
- Strict: Users must be logged into added applications and said applications must be registered in the directory in order to connect to the directory
- The “Allow Instance Discovery” option restricts how much data applications can access via the FDC3 API
- Broadcasting, provides a default communication bus, where if an application sends a message it will send it to all other applications. This is simpler, than having channels, which provides you the ability for apps to be grouped onto the same communication channel.
- The “Delivery Hook” setting allows you to specify an endpoint that can transform context data sent from broadcast or intents in the directory. This can be done on a per/context data type basis and can be used to normalize and enhance context transferred between applications as well as to redact and enforce data security policies.
- Click the 'Create' button at the bottom of the page to complete creating your directory.
Edit Directories
- From the directories level: Click on the actions on the directory card. Select 'Edit' to begin editing or 'Settings' to view all of the settings.
-
From view directory: Click on the upper right 'Edit Settings' button.
-
Don't forget to click 'Update' when you've completed your changes. Changes will take immediate affect.
Connecting to a Directory
Directories determines what applications can participate and what the security parameters will be. Any application using the Agent SDK makes a connection to a directory.
To connect to a directory, use the createAgent function exported from the agent-web module, and pass in the service URL and the identity of your application. This will return a Promise resolving to a standard FDC3 API.
import { createAgent } from '@connectifi/agent-web';
const fdc3 = await createAgent(
`https://platform.connectifi.app`,
`$[appName]@$[directoryName]`,
);
Note: Because the FDC3 API is returned as a scoped variable, your application can leverage any number of approaches to FDC3. For example, the API can be used in module scope - allowing for multiple connections on a page, or it can be declared as a global - providing backwards compatibility with desktop container patterns. Also, the connection to the service can be multiplexed to allow for multiple FDC3 'apps' in a single page. For an example of multiplexing, see this open source repo (opens in a new tab).