@openfin/remote-adapter 36.78.13 → 36.79.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +3 -0
- package/README.md +62 -0
- package/out/backchannel.js +17 -4
- package/out/remote-adapter-alpha.d.ts +18763 -26
- package/out/remote-adapter-beta.d.ts +18763 -26
- package/out/remote-adapter-public.d.ts +18763 -26
- package/out/remote-adapter.d.ts +19210 -26
- package/out/remote-adapter.js +1160 -1170
- package/package.json +6 -6
- package/out/backchannel-e240e597.js +0 -500
package/LICENSE.md
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Remote Adapter
|
|
2
|
+
|
|
3
|
+
This package contains APIs for proxying API messages between OpenFin applications running on different machines.
|
|
4
|
+
|
|
5
|
+
The APIs provided require WebRTC [peer connections](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection). This package does not provide WebRTC peer connections for you, establishing those is up to you.
|
|
6
|
+
|
|
7
|
+
Useful resources:
|
|
8
|
+
|
|
9
|
+
- [Getting started with peer connections](https://webrtc.org/getting-started/peer-connections)
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
With npm:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
$ npm i -S @openfin/remote-adapter
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
With yarn:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
$ yarn add @openfin/remote-adapter
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
Initialize a connection from a "host" OpenFin application.
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { init } from '@openfin/remote-adapter';
|
|
31
|
+
|
|
32
|
+
const rtcPeer = createWebRTCPeer(); // we don't provide this function it is the user's responsibility to create a RTCPeerConnection
|
|
33
|
+
|
|
34
|
+
await init({ fin: window.fin, rtc: rtcPeer });
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Connect to the "host" application from a "remote" application.
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
import { connect } from '@openfin/remote-adapter';
|
|
41
|
+
import { fdc3FromFin } from '@openfin/fdc3-api';
|
|
42
|
+
|
|
43
|
+
const rtcPeer = createWebRTCPeer(); // we don't provide this function it is the user's responsibility to create a RTCPeerConnection
|
|
44
|
+
|
|
45
|
+
const fin = await connect({ rtc: rtcPeer });
|
|
46
|
+
|
|
47
|
+
// Connect to the host application as an interop client.
|
|
48
|
+
fin.me.interop = fin.Interop.connectSync('<HOST_APP_UUID>', {});
|
|
49
|
+
|
|
50
|
+
// Get an instance of fdc3 from using the fdc3-api package (https://www.npmjs.com/package/@openfin/fdc3-api).
|
|
51
|
+
const fdc3 = await fdc3FromFin(fin);
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## License
|
|
55
|
+
|
|
56
|
+
Copyright 2020-2023 OpenFin
|
|
57
|
+
|
|
58
|
+
The code in this package is distributed under the Apache License, Version 2.0.
|
|
59
|
+
|
|
60
|
+
However, if you run this code, it may call on the OpenFin RVM or OpenFin Runtime, which are covered by OpenFin's Developer, Community, and Enterprise licenses. You can learn more about OpenFin licensing at the links listed below or email us at support@openfin.co with questions.
|
|
61
|
+
|
|
62
|
+
- [Developer agreement](https://openfin.co/developer-agreement/)
|
package/out/backchannel.js
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./bridge-ef11968f.js');
|
|
3
|
+
var require$$0 = require('events');
|
|
4
|
+
var bridge = require('./bridge-ef11968f.js');
|
|
5
5
|
|
|
6
|
+
class BackChannel extends require$$0.EventEmitter {
|
|
7
|
+
constructor(datachannel) {
|
|
8
|
+
super();
|
|
9
|
+
this.datachannel = datachannel;
|
|
10
|
+
this.onmessage = (message) => {
|
|
11
|
+
const data = JSON.parse(message.data);
|
|
12
|
+
this.emit(data.type, data);
|
|
13
|
+
};
|
|
14
|
+
this.send = (data) => {
|
|
15
|
+
this.datachannel.send(JSON.stringify(data));
|
|
16
|
+
};
|
|
17
|
+
this.opened = bridge.initializeMessageReceiver(datachannel, this.onmessage, () => this.emit('closed', { type: 'closed' }));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
6
20
|
|
|
7
|
-
|
|
8
|
-
exports.BackChannel = backchannel.BackChannel;
|
|
21
|
+
exports.BackChannel = BackChannel;
|