@openfin/web-interop v0.37.17
@openfin/web-interop
This npm library facilitates the use of OpenFin's channels API across origins within a web browser.
Key Concepts
Web Broker
A hosted iframe that enables cross-origin communication.
Web Client
A connection to the web broker that leverages the fin
API.
Client Library Usage
To utilize the client library, you need to be aware of the URL of your web broker.
import { connect } from '@openfin/web-interop';
const brokerUrl = 'http://example.com/web-broker';
const timeout = 30 * 1000; // Default timeout is infinite, short circuit earlier
const fin = await connect({ brokerUrl, timeout });
const channelClient = await fin.InterApplicationBus.Channel.connect('foo');
Supported APIs
fin.me.identity
- your randomly generated identityfin.InterApplicationBus.Channel.connect
fin.InterApplicationBus.Channel.create
The only supported channel strategy is classic
Hosting a Web Broker
In order to use this library, you must connect to a web broker. The web broker behaves like an instance of the OpenFin runtime for channel uniqueness.
The Web Broker requires that a copy of @openfin/web-interop/shared-worker
be hosted alongside it within the same origin.
Accepting Connections
To initialize the connection from an embedding browsing context, a shared worker URL must be specified as shown below.
import { init } from '@openfin/web-interop/iframe-broker';
init({
sharedWorkerUrl: `${location.origin}/shared-worker.js`
});
Rejecting Connections
The web broker runs as an iframe embedded in the client page, so standard web APIs can be used to detect the embedder info if you wish to reject connections.
If you have a 404 or other error pages, this call can also be used to ensure redirected brokers do not hang the client connections.
import { rejectConnections } from '@openfin/web-interop/iframe-broker';
rejectConnections({ reason: 'custom error message' });
Further Reading
18 days ago
19 days ago
20 days ago
26 days ago
30 days ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago