@openfin/core 25.68.30 → 25.70.2
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/OpenFin.d.ts +30 -826
- package/README.md +12 -2
- package/package.json +1 -1
- package/src/api/application/Factory.d.ts +145 -145
- package/src/api/application/Factory.js +229 -229
- package/src/api/application/Instance.d.ts +301 -302
- package/src/api/application/Instance.js +412 -412
- package/src/api/application/index.d.ts +3 -3
- package/src/api/application/index.js +15 -15
- package/src/api/base.d.ts +43 -43
- package/src/api/base.js +177 -177
- package/src/api/clipboard/index.d.ts +69 -69
- package/src/api/clipboard/index.js +88 -88
- package/src/api/events/application.d.ts +69 -0
- package/src/api/events/application.js +2 -0
- package/src/api/events/base.d.ts +17 -0
- package/src/api/events/base.js +2 -0
- package/src/api/events/channel.d.ts +10 -11
- package/src/api/events/channel.js +2 -2
- package/src/api/events/emitterMap.d.ts +11 -11
- package/src/api/events/emitterMap.js +35 -35
- package/src/api/events/eventAggregator.d.ts +5 -5
- package/src/api/events/eventAggregator.js +43 -43
- package/src/api/events/externalApplication.d.ts +5 -0
- package/src/api/events/externalApplication.js +2 -0
- package/src/api/events/frame.d.ts +9 -0
- package/src/api/events/frame.js +2 -0
- package/src/api/events/globalHotkey.d.ts +10 -0
- package/src/api/events/globalHotkey.js +2 -0
- package/src/api/events/platform.d.ts +18 -0
- package/src/api/events/platform.js +2 -0
- package/src/api/events/system.d.ts +22 -0
- package/src/api/events/system.js +2 -0
- package/src/api/events/view.d.ts +56 -0
- package/src/api/events/view.js +2 -0
- package/src/api/events/webcontents.d.ts +48 -0
- package/src/api/events/webcontents.js +2 -0
- package/src/api/events/window.d.ts +176 -0
- package/src/api/events/window.js +2 -0
- package/src/api/external-application/Factory.d.ts +26 -26
- package/src/api/external-application/Factory.js +40 -40
- package/src/api/external-application/Instance.d.ts +101 -102
- package/src/api/external-application/Instance.js +109 -109
- package/src/api/external-application/index.d.ts +3 -3
- package/src/api/external-application/index.js +15 -15
- package/src/api/fin.d.ts +49 -49
- package/src/api/fin.js +43 -43
- package/src/api/frame/Factory.d.ts +36 -36
- package/src/api/frame/Factory.js +69 -69
- package/src/api/frame/Instance.d.ts +121 -121
- package/src/api/frame/Instance.js +130 -130
- package/src/api/frame/index.d.ts +3 -3
- package/src/api/frame/index.js +15 -15
- package/src/api/global-hotkey/index.d.ts +38 -38
- package/src/api/global-hotkey/index.js +58 -58
- package/src/api/interappbus/channel/channel.d.ts +26 -26
- package/src/api/interappbus/channel/channel.js +77 -77
- package/src/api/interappbus/channel/channels-docs.d.ts +318 -318
- package/src/api/interappbus/channel/channels-docs.js +376 -376
- package/src/api/interappbus/channel/client.d.ts +22 -22
- package/src/api/interappbus/channel/client.js +84 -84
- package/src/api/interappbus/channel/connection-manager.d.ts +28 -28
- package/src/api/interappbus/channel/connection-manager.js +244 -244
- package/src/api/interappbus/channel/index.d.ts +22 -23
- package/src/api/interappbus/channel/index.js +121 -121
- package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +13 -13
- package/src/api/interappbus/channel/protocols/classic/message-receiver.js +73 -73
- package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +22 -22
- package/src/api/interappbus/channel/protocols/classic/strategy.js +84 -84
- package/src/api/interappbus/channel/protocols/combined/strategy.d.ts +20 -20
- package/src/api/interappbus/channel/protocols/combined/strategy.js +58 -58
- package/src/api/interappbus/channel/protocols/index.d.ts +44 -44
- package/src/api/interappbus/channel/protocols/index.js +2 -2
- package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +10 -10
- package/src/api/interappbus/channel/protocols/protocol-manager.js +43 -43
- package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +23 -23
- package/src/api/interappbus/channel/protocols/rtc/endpoint.js +135 -135
- package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +30 -30
- package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +131 -131
- package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +22 -22
- package/src/api/interappbus/channel/protocols/rtc/strategy.js +87 -87
- package/src/api/interappbus/channel/protocols/strategy-types.d.ts +13 -13
- package/src/api/interappbus/channel/protocols/strategy-types.js +2 -2
- package/src/api/interappbus/channel/protocols/strategy.d.ts +15 -15
- package/src/api/interappbus/channel/protocols/strategy.js +2 -2
- package/src/api/interappbus/channel/provider.d.ts +31 -31
- package/src/api/interappbus/channel/provider.js +160 -160
- package/src/api/interappbus/index.d.ts +85 -86
- package/src/api/interappbus/index.js +175 -175
- package/src/api/interop/Factory.d.ts +37 -37
- package/src/api/interop/Factory.js +54 -54
- package/src/api/interop/InteropBroker.d.ts +363 -363
- package/src/api/interop/InteropBroker.js +914 -914
- package/src/api/interop/InteropClient.d.ts +268 -268
- package/src/api/interop/InteropClient.js +450 -450
- package/src/api/interop/SessionContextGroupBroker.d.ts +26 -26
- package/src/api/interop/SessionContextGroupBroker.js +107 -107
- package/src/api/interop/SessionContextGroupClient.d.ts +20 -20
- package/src/api/interop/SessionContextGroupClient.js +85 -85
- package/src/api/interop/fdc3/fdc3-1.2.d.ts +187 -187
- package/src/api/interop/fdc3/fdc3-1.2.js +385 -385
- package/src/api/interop/fdc3/fdc3.js +17 -17
- package/src/api/interop/fdc3/utils.d.ts +6 -6
- package/src/api/interop/fdc3/utils.js +17 -17
- package/src/api/interop/index.d.ts +4 -4
- package/src/api/interop/index.js +16 -16
- package/src/api/interop/utils.d.ts +11 -11
- package/src/api/interop/utils.js +36 -36
- package/src/api/me.d.ts +38 -35
- package/src/api/me.js +128 -60
- package/src/api/platform/Factory.d.ts +109 -109
- package/src/api/platform/Factory.js +188 -188
- package/src/api/platform/Instance.d.ts +122 -122
- package/src/api/platform/Instance.js +298 -298
- package/src/api/platform/common-utils.d.ts +6 -6
- package/src/api/platform/common-utils.js +16 -16
- package/src/api/platform/index.d.ts +3 -3
- package/src/api/platform/index.js +15 -15
- package/src/api/platform/layout/Factory.d.ts +108 -108
- package/src/api/platform/layout/Factory.js +189 -189
- package/src/api/platform/layout/Instance.d.ts +49 -49
- package/src/api/platform/layout/Instance.js +99 -99
- package/src/api/platform/layout/index.d.ts +2 -2
- package/src/api/platform/layout/index.js +14 -14
- package/src/api/platform/layout/shapes.d.ts +11 -0
- package/src/api/{window → platform/layout}/shapes.js +2 -2
- package/src/api/snapshot-source/Factory.d.ts +36 -36
- package/src/api/snapshot-source/Factory.js +65 -65
- package/src/api/snapshot-source/Instance.d.ts +30 -30
- package/src/api/snapshot-source/Instance.js +134 -134
- package/src/api/snapshot-source/index.d.ts +3 -3
- package/src/api/snapshot-source/index.js +15 -15
- package/src/api/snapshot-source/utils.d.ts +1 -1
- package/src/api/snapshot-source/utils.js +5 -5
- package/src/api/system/index.d.ts +960 -961
- package/src/api/system/index.js +1241 -1241
- package/src/api/view/Factory.d.ts +49 -49
- package/src/api/view/Factory.js +103 -103
- package/src/api/view/Instance.d.ts +387 -380
- package/src/api/view/Instance.js +422 -415
- package/src/api/view/index.d.ts +3 -3
- package/src/api/view/index.js +15 -15
- package/src/api/webcontents/main.d.ts +36 -36
- package/src/api/webcontents/main.js +82 -82
- package/src/api/window/Factory.d.ts +44 -44
- package/src/api/window/Factory.js +91 -91
- package/src/api/window/Instance.d.ts +972 -966
- package/src/api/window/Instance.js +1209 -1202
- package/src/api/window/index.d.ts +3 -5
- package/src/api/window/index.js +15 -17
- package/src/environment/environment.d.ts +28 -25
- package/src/environment/environment.js +4 -4
- package/src/environment/node-env.d.ts +25 -26
- package/src/environment/node-env.js +64 -64
- package/src/environment/openfin-env.d.ts +29 -30
- package/src/environment/openfin-env.js +107 -107
- package/src/mock.d.ts +3 -3
- package/src/mock.js +91 -90
- package/src/shapes/ERROR_BOX_TYPES.d.ts +1 -0
- package/src/shapes/ERROR_BOX_TYPES.js +2 -0
- package/src/shapes/WebOptions.d.ts +12 -0
- package/src/shapes/WebOptions.js +2 -0
- package/src/shapes/WindowOptions.d.ts +42 -0
- package/src/shapes/WindowOptions.js +2 -0
- package/src/shapes/protocol.d.ts +178 -0
- package/src/shapes/protocol.js +2 -0
- package/src/transport/fin_store.d.ts +4 -4
- package/src/transport/fin_store.js +16 -16
- package/src/transport/transport-errors.d.ts +18 -18
- package/src/transport/transport-errors.js +37 -37
- package/src/transport/transport.d.ts +56 -43
- package/src/transport/transport.js +181 -181
- package/src/transport/wire.d.ts +71 -11
- package/src/transport/wire.js +32 -32
- package/src/util/asyncFilter.d.ts +1 -1
- package/src/util/asyncFilter.js +7 -7
- package/src/util/errors.d.ts +9 -5
- package/src/util/errors.js +11 -11
- package/src/util/exhaustive.d.ts +1 -1
- package/src/util/exhaustive.js +7 -7
- package/src/util/http.d.ts +11 -11
- package/src/util/http.js +83 -83
- package/src/util/normalize-config.d.ts +3 -5
- package/src/util/normalize-config.js +47 -47
- package/src/util/promises.d.ts +5 -5
- package/src/util/promises.js +27 -27
- package/src/util/ref-counter.d.ts +7 -7
- package/src/util/ref-counter.js +51 -51
- package/src/util/runtimeVersioning.d.ts +3 -3
- package/src/util/runtimeVersioning.js +25 -25
- package/src/util/utilTypes.d.ts +8 -8
- package/src/util/utilTypes.js +2 -2
- package/src/util/validate.d.ts +3 -3
- package/src/util/validate.js +11 -11
- package/docs.README(OLD).md +0 -82
- package/resources/win/OpenFinRVM.exe +0 -0
- package/src/api/window/bounds-changed.d.ts +0 -10
- package/src/api/window/bounds-changed.js +0 -6
- package/src/api/window/shapes.d.ts +0 -13
|
@@ -1,135 +1,135 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
|
|
4
|
-
if (!privateMap.has(receiver)) {
|
|
5
|
-
throw new TypeError("attempted to get private field on non-instance");
|
|
6
|
-
}
|
|
7
|
-
return privateMap.get(receiver);
|
|
8
|
-
};
|
|
9
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
|
|
10
|
-
if (!privateMap.has(receiver)) {
|
|
11
|
-
throw new TypeError("attempted to set private field on non-instance");
|
|
12
|
-
}
|
|
13
|
-
privateMap.set(receiver, value);
|
|
14
|
-
return value;
|
|
15
|
-
};
|
|
16
|
-
var _processAction, _disconnectListener;
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.RTCEndpoint = void 0;
|
|
19
|
-
const errors_1 = require("../../../../../util/errors");
|
|
20
|
-
/*
|
|
21
|
-
This handles sending RTC messages between RTC connections over the request and response data channels.
|
|
22
|
-
*/
|
|
23
|
-
class RTCEndpoint {
|
|
24
|
-
constructor(rtc, endpointIdentity) {
|
|
25
|
-
this.rtc = rtc;
|
|
26
|
-
this.endpointIdentity = endpointIdentity;
|
|
27
|
-
this.responseMap = new Map();
|
|
28
|
-
_processAction.set(this, null);
|
|
29
|
-
_disconnectListener.set(this, void 0);
|
|
30
|
-
this.connectionStateChangeHandler = (event) => {
|
|
31
|
-
if (this.rtc.rtcClient.connectionState !== 'connected') {
|
|
32
|
-
this.rtc.rtcClient.removeEventListener('connectionstatechange', this.connectionStateChangeHandler);
|
|
33
|
-
this.close();
|
|
34
|
-
if (__classPrivateFieldGet(this, _disconnectListener)) {
|
|
35
|
-
__classPrivateFieldGet(this, _disconnectListener).call(this);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
this.send = async (action, payload) => {
|
|
40
|
-
const messageId = `message-${Math.random()}`;
|
|
41
|
-
const promise = new Promise((resolve, reject) => {
|
|
42
|
-
this.responseMap.set(messageId, { resolve, reject });
|
|
43
|
-
});
|
|
44
|
-
this.rtc.channels.request.send(JSON.stringify({ action, payload, messageId }));
|
|
45
|
-
return promise;
|
|
46
|
-
};
|
|
47
|
-
this.close = () => {
|
|
48
|
-
this.responseMap.forEach((response) => response.reject('Connection has closed.'));
|
|
49
|
-
this.responseMap = new Map();
|
|
50
|
-
this.rtc.channels.request.close();
|
|
51
|
-
this.rtc.channels.response.close();
|
|
52
|
-
this.rtc.rtcClient.close();
|
|
53
|
-
};
|
|
54
|
-
this.rtc.channels.response.addEventListener('message', (e) => {
|
|
55
|
-
var _a;
|
|
56
|
-
const { messageId, payload, success, error } = JSON.parse(e.data);
|
|
57
|
-
const { resolve, reject } = (_a = this.responseMap.get(messageId)) !== null && _a !== void 0 ? _a : {};
|
|
58
|
-
if (resolve && reject) {
|
|
59
|
-
this.responseMap.delete(messageId);
|
|
60
|
-
if (success) {
|
|
61
|
-
resolve(payload);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
reject(error);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
console.log('Could not find id in responseMap.');
|
|
69
|
-
console.log(e);
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
this.rtc.channels.request.addEventListener('message', async (e) => {
|
|
73
|
-
const { messageId, action, payload } = JSON.parse(e.data);
|
|
74
|
-
if (__classPrivateFieldGet(this, _processAction)) {
|
|
75
|
-
try {
|
|
76
|
-
const res = await __classPrivateFieldGet(this, _processAction).call(this, action, payload, endpointIdentity);
|
|
77
|
-
this.rtc.channels.response.send(JSON.stringify({
|
|
78
|
-
messageId,
|
|
79
|
-
payload: res,
|
|
80
|
-
success: true
|
|
81
|
-
}));
|
|
82
|
-
}
|
|
83
|
-
catch (error) {
|
|
84
|
-
// Check if RTCDataChannel is open before sending, error gets swallowed here in the case where
|
|
85
|
-
// client dispatched then closed or disconnected before the dispatch resolves.
|
|
86
|
-
if (this.rtc.channels.response.readyState === 'open') {
|
|
87
|
-
this.rtc.channels.response.send(JSON.stringify({
|
|
88
|
-
messageId,
|
|
89
|
-
error: errors_1.errorToPOJO(error),
|
|
90
|
-
success: false
|
|
91
|
-
}));
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
// Check if RTCDataChannel is open for same reason as catch block above.
|
|
95
|
-
}
|
|
96
|
-
else if (this.rtc.channels.response.readyState === 'open') {
|
|
97
|
-
this.rtc.channels.response.send(JSON.stringify({
|
|
98
|
-
messageId,
|
|
99
|
-
success: false,
|
|
100
|
-
error: 'Connection not ready.'
|
|
101
|
-
}));
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
this.rtc.rtcClient.addEventListener('connectionstatechange', this.connectionStateChangeHandler);
|
|
105
|
-
// Disconnect if data channels close unexpectedly, e.g. can happen due to message size > ~255kB (RTCPeerConnection.sctp.maxMessageSizeLimit: 262144)
|
|
106
|
-
Object.values(this.rtc.channels).forEach((datachannel) => {
|
|
107
|
-
datachannel.onclose = (e) => {
|
|
108
|
-
[...this.responseMap.values()].forEach((promise) => promise.reject(new Error('RTCDataChannel closed unexpectedly, this is most commonly caused by message size. Note: RTC Channels have a message size limit of ~255kB.')));
|
|
109
|
-
this.close();
|
|
110
|
-
if (__classPrivateFieldGet(this, _disconnectListener)) {
|
|
111
|
-
__classPrivateFieldGet(this, _disconnectListener).call(this);
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
onDisconnect(listener) {
|
|
117
|
-
if (!__classPrivateFieldGet(this, _disconnectListener)) {
|
|
118
|
-
__classPrivateFieldSet(this, _disconnectListener, listener);
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
throw new Error('RTCEndpoint disconnectListener cannot be set twice.');
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
receive(listener) {
|
|
125
|
-
if (__classPrivateFieldGet(this, _processAction)) {
|
|
126
|
-
throw new Error('You have already set a listener for this RTC Endpoint.');
|
|
127
|
-
}
|
|
128
|
-
__classPrivateFieldSet(this, _processAction, listener);
|
|
129
|
-
}
|
|
130
|
-
get connected() {
|
|
131
|
-
return this.rtc.rtcClient.connectionState === 'connected';
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
exports.RTCEndpoint = RTCEndpoint;
|
|
135
|
-
_processAction = new WeakMap(), _disconnectListener = new WeakMap();
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
|
|
4
|
+
if (!privateMap.has(receiver)) {
|
|
5
|
+
throw new TypeError("attempted to get private field on non-instance");
|
|
6
|
+
}
|
|
7
|
+
return privateMap.get(receiver);
|
|
8
|
+
};
|
|
9
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
|
|
10
|
+
if (!privateMap.has(receiver)) {
|
|
11
|
+
throw new TypeError("attempted to set private field on non-instance");
|
|
12
|
+
}
|
|
13
|
+
privateMap.set(receiver, value);
|
|
14
|
+
return value;
|
|
15
|
+
};
|
|
16
|
+
var _processAction, _disconnectListener;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.RTCEndpoint = void 0;
|
|
19
|
+
const errors_1 = require("../../../../../util/errors");
|
|
20
|
+
/*
|
|
21
|
+
This handles sending RTC messages between RTC connections over the request and response data channels.
|
|
22
|
+
*/
|
|
23
|
+
class RTCEndpoint {
|
|
24
|
+
constructor(rtc, endpointIdentity) {
|
|
25
|
+
this.rtc = rtc;
|
|
26
|
+
this.endpointIdentity = endpointIdentity;
|
|
27
|
+
this.responseMap = new Map();
|
|
28
|
+
_processAction.set(this, null);
|
|
29
|
+
_disconnectListener.set(this, void 0);
|
|
30
|
+
this.connectionStateChangeHandler = (event) => {
|
|
31
|
+
if (this.rtc.rtcClient.connectionState !== 'connected') {
|
|
32
|
+
this.rtc.rtcClient.removeEventListener('connectionstatechange', this.connectionStateChangeHandler);
|
|
33
|
+
this.close();
|
|
34
|
+
if (__classPrivateFieldGet(this, _disconnectListener)) {
|
|
35
|
+
__classPrivateFieldGet(this, _disconnectListener).call(this);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
this.send = async (action, payload) => {
|
|
40
|
+
const messageId = `message-${Math.random()}`;
|
|
41
|
+
const promise = new Promise((resolve, reject) => {
|
|
42
|
+
this.responseMap.set(messageId, { resolve, reject });
|
|
43
|
+
});
|
|
44
|
+
this.rtc.channels.request.send(JSON.stringify({ action, payload, messageId }));
|
|
45
|
+
return promise;
|
|
46
|
+
};
|
|
47
|
+
this.close = () => {
|
|
48
|
+
this.responseMap.forEach((response) => response.reject('Connection has closed.'));
|
|
49
|
+
this.responseMap = new Map();
|
|
50
|
+
this.rtc.channels.request.close();
|
|
51
|
+
this.rtc.channels.response.close();
|
|
52
|
+
this.rtc.rtcClient.close();
|
|
53
|
+
};
|
|
54
|
+
this.rtc.channels.response.addEventListener('message', (e) => {
|
|
55
|
+
var _a;
|
|
56
|
+
const { messageId, payload, success, error } = JSON.parse(e.data);
|
|
57
|
+
const { resolve, reject } = (_a = this.responseMap.get(messageId)) !== null && _a !== void 0 ? _a : {};
|
|
58
|
+
if (resolve && reject) {
|
|
59
|
+
this.responseMap.delete(messageId);
|
|
60
|
+
if (success) {
|
|
61
|
+
resolve(payload);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
reject(error);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
console.log('Could not find id in responseMap.');
|
|
69
|
+
console.log(e);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
this.rtc.channels.request.addEventListener('message', async (e) => {
|
|
73
|
+
const { messageId, action, payload } = JSON.parse(e.data);
|
|
74
|
+
if (__classPrivateFieldGet(this, _processAction)) {
|
|
75
|
+
try {
|
|
76
|
+
const res = await __classPrivateFieldGet(this, _processAction).call(this, action, payload, endpointIdentity);
|
|
77
|
+
this.rtc.channels.response.send(JSON.stringify({
|
|
78
|
+
messageId,
|
|
79
|
+
payload: res,
|
|
80
|
+
success: true
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
// Check if RTCDataChannel is open before sending, error gets swallowed here in the case where
|
|
85
|
+
// client dispatched then closed or disconnected before the dispatch resolves.
|
|
86
|
+
if (this.rtc.channels.response.readyState === 'open') {
|
|
87
|
+
this.rtc.channels.response.send(JSON.stringify({
|
|
88
|
+
messageId,
|
|
89
|
+
error: errors_1.errorToPOJO(error),
|
|
90
|
+
success: false
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// Check if RTCDataChannel is open for same reason as catch block above.
|
|
95
|
+
}
|
|
96
|
+
else if (this.rtc.channels.response.readyState === 'open') {
|
|
97
|
+
this.rtc.channels.response.send(JSON.stringify({
|
|
98
|
+
messageId,
|
|
99
|
+
success: false,
|
|
100
|
+
error: 'Connection not ready.'
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
this.rtc.rtcClient.addEventListener('connectionstatechange', this.connectionStateChangeHandler);
|
|
105
|
+
// Disconnect if data channels close unexpectedly, e.g. can happen due to message size > ~255kB (RTCPeerConnection.sctp.maxMessageSizeLimit: 262144)
|
|
106
|
+
Object.values(this.rtc.channels).forEach((datachannel) => {
|
|
107
|
+
datachannel.onclose = (e) => {
|
|
108
|
+
[...this.responseMap.values()].forEach((promise) => promise.reject(new Error('RTCDataChannel closed unexpectedly, this is most commonly caused by message size. Note: RTC Channels have a message size limit of ~255kB.')));
|
|
109
|
+
this.close();
|
|
110
|
+
if (__classPrivateFieldGet(this, _disconnectListener)) {
|
|
111
|
+
__classPrivateFieldGet(this, _disconnectListener).call(this);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
onDisconnect(listener) {
|
|
117
|
+
if (!__classPrivateFieldGet(this, _disconnectListener)) {
|
|
118
|
+
__classPrivateFieldSet(this, _disconnectListener, listener);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
throw new Error('RTCEndpoint disconnectListener cannot be set twice.');
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
receive(listener) {
|
|
125
|
+
if (__classPrivateFieldGet(this, _processAction)) {
|
|
126
|
+
throw new Error('You have already set a listener for this RTC Endpoint.');
|
|
127
|
+
}
|
|
128
|
+
__classPrivateFieldSet(this, _processAction, listener);
|
|
129
|
+
}
|
|
130
|
+
get connected() {
|
|
131
|
+
return this.rtc.rtcClient.connectionState === 'connected';
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
exports.RTCEndpoint = RTCEndpoint;
|
|
135
|
+
_processAction = new WeakMap(), _disconnectListener = new WeakMap();
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import Transport from '../../../../../transport/transport';
|
|
2
|
-
import { EmitterBase } from '../../../../base';
|
|
3
|
-
import { RTCEndpointChannels } from './endpoint';
|
|
4
|
-
export declare class RTCICEManager extends EmitterBase<any> {
|
|
5
|
-
constructor(wire: Transport);
|
|
6
|
-
static createDataChannelPromise(label: string, rtcClient: RTCPeerConnection): Promise<RTCDataChannel>;
|
|
7
|
-
ensureChannelOpened: (channel: RTCDataChannel) => Promise<void>;
|
|
8
|
-
listenForProviderIce(rtcConnectionId: string, listener: any): Promise<void>;
|
|
9
|
-
raiseProviderIce(rtcConnectionId: string, payload: any): Promise<void>;
|
|
10
|
-
listenForClientIce(rtcConnectionId: string, listener: any): Promise<void>;
|
|
11
|
-
raiseClientIce(rtcConnectionId: string, payload: any): Promise<void>;
|
|
12
|
-
private cleanupIceListeners;
|
|
13
|
-
private createClientEventName;
|
|
14
|
-
private createProviderEventName;
|
|
15
|
-
private createRouteString;
|
|
16
|
-
private createRtcPeer;
|
|
17
|
-
startClientOffer(): Promise<{
|
|
18
|
-
rtcClient: RTCPeerConnection;
|
|
19
|
-
offer: RTCSessionDescriptionInit;
|
|
20
|
-
channels: RTCEndpointChannels;
|
|
21
|
-
rtcConnectionId: string;
|
|
22
|
-
channelsOpened: Promise<void>;
|
|
23
|
-
}>;
|
|
24
|
-
finishClientOffer(rtcClient: RTCPeerConnection, answer: RTCSessionDescriptionInit, providerReady: Promise<void>): Promise<boolean>;
|
|
25
|
-
createProviderAnswer(rtcConnectionId: string, offer: RTCSessionDescriptionInit): Promise<{
|
|
26
|
-
rtcClient: RTCPeerConnection;
|
|
27
|
-
answer: RTCSessionDescriptionInit;
|
|
28
|
-
channels: Promise<RTCEndpointChannels>;
|
|
29
|
-
}>;
|
|
30
|
-
}
|
|
1
|
+
import Transport from '../../../../../transport/transport';
|
|
2
|
+
import { EmitterBase } from '../../../../base';
|
|
3
|
+
import { RTCEndpointChannels } from './endpoint';
|
|
4
|
+
export declare class RTCICEManager extends EmitterBase<any> {
|
|
5
|
+
constructor(wire: Transport);
|
|
6
|
+
static createDataChannelPromise(label: string, rtcClient: RTCPeerConnection): Promise<RTCDataChannel>;
|
|
7
|
+
ensureChannelOpened: (channel: RTCDataChannel) => Promise<void>;
|
|
8
|
+
listenForProviderIce(rtcConnectionId: string, listener: any): Promise<void>;
|
|
9
|
+
raiseProviderIce(rtcConnectionId: string, payload: any): Promise<void>;
|
|
10
|
+
listenForClientIce(rtcConnectionId: string, listener: any): Promise<void>;
|
|
11
|
+
raiseClientIce(rtcConnectionId: string, payload: any): Promise<void>;
|
|
12
|
+
private cleanupIceListeners;
|
|
13
|
+
private createClientEventName;
|
|
14
|
+
private createProviderEventName;
|
|
15
|
+
private createRouteString;
|
|
16
|
+
private createRtcPeer;
|
|
17
|
+
startClientOffer(): Promise<{
|
|
18
|
+
rtcClient: RTCPeerConnection;
|
|
19
|
+
offer: RTCSessionDescriptionInit;
|
|
20
|
+
channels: RTCEndpointChannels;
|
|
21
|
+
rtcConnectionId: string;
|
|
22
|
+
channelsOpened: Promise<void>;
|
|
23
|
+
}>;
|
|
24
|
+
finishClientOffer(rtcClient: RTCPeerConnection, answer: RTCSessionDescriptionInit, providerReady: Promise<void>): Promise<boolean>;
|
|
25
|
+
createProviderAnswer(rtcConnectionId: string, offer: RTCSessionDescriptionInit): Promise<{
|
|
26
|
+
rtcClient: RTCPeerConnection;
|
|
27
|
+
answer: RTCSessionDescriptionInit;
|
|
28
|
+
channels: Promise<RTCEndpointChannels>;
|
|
29
|
+
}>;
|
|
30
|
+
}
|
|
@@ -1,131 +1,131 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* eslint-disable class-methods-use-this */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.RTCICEManager = void 0;
|
|
5
|
-
const base_1 = require("../../../../base");
|
|
6
|
-
/*
|
|
7
|
-
Singleton that facilitates Offer and Answer exchange required for establishing RTC connections.
|
|
8
|
-
*/
|
|
9
|
-
class RTCICEManager extends base_1.EmitterBase {
|
|
10
|
-
constructor(wire) {
|
|
11
|
-
super(wire, 'channel');
|
|
12
|
-
this.ensureChannelOpened = (channel) => {
|
|
13
|
-
return new Promise((resolve, reject) => {
|
|
14
|
-
if (channel.readyState === 'open') {
|
|
15
|
-
resolve();
|
|
16
|
-
}
|
|
17
|
-
else if (channel.readyState === 'connecting') {
|
|
18
|
-
const listener = () => {
|
|
19
|
-
channel.removeEventListener('open', listener);
|
|
20
|
-
resolve();
|
|
21
|
-
};
|
|
22
|
-
channel.addEventListener('open', listener);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
reject(new Error('This Channel has already closed'));
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
static createDataChannelPromise(label, rtcClient) {
|
|
31
|
-
let resolver;
|
|
32
|
-
const promise = new Promise((resolve) => {
|
|
33
|
-
resolver = resolve;
|
|
34
|
-
});
|
|
35
|
-
const listener = (e) => {
|
|
36
|
-
const openListener = () => {
|
|
37
|
-
e.channel.removeEventListener('open', openListener);
|
|
38
|
-
resolver(e.channel);
|
|
39
|
-
};
|
|
40
|
-
if (e.channel.label === label) {
|
|
41
|
-
e.channel.addEventListener('open', openListener);
|
|
42
|
-
rtcClient.removeEventListener('datachannel', listener);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
rtcClient.addEventListener('datachannel', listener);
|
|
46
|
-
return promise;
|
|
47
|
-
}
|
|
48
|
-
async listenForProviderIce(rtcConnectionId, listener) {
|
|
49
|
-
await this.on(this.createProviderEventName(rtcConnectionId), listener, { timestamp: Date.now() });
|
|
50
|
-
}
|
|
51
|
-
async raiseProviderIce(rtcConnectionId, payload) {
|
|
52
|
-
await this.wire.environment.raiseEvent(this.createRouteString(this.createProviderEventName(rtcConnectionId)), payload);
|
|
53
|
-
}
|
|
54
|
-
async listenForClientIce(rtcConnectionId, listener) {
|
|
55
|
-
await this.on(this.createClientEventName(rtcConnectionId), listener, { timestamp: Date.now() });
|
|
56
|
-
}
|
|
57
|
-
async raiseClientIce(rtcConnectionId, payload) {
|
|
58
|
-
await this.wire.environment.raiseEvent(this.createRouteString(this.createClientEventName(rtcConnectionId)), payload);
|
|
59
|
-
}
|
|
60
|
-
cleanupIceListeners(rtcConnectionId) {
|
|
61
|
-
this.removeAllListeners(this.createClientEventName(rtcConnectionId));
|
|
62
|
-
this.removeAllListeners(this.createProviderEventName(rtcConnectionId));
|
|
63
|
-
}
|
|
64
|
-
createClientEventName(rtcConnectionId) {
|
|
65
|
-
return `ice-client-${rtcConnectionId}`;
|
|
66
|
-
}
|
|
67
|
-
createProviderEventName(rtcConnectionId) {
|
|
68
|
-
return `ice-provider-${rtcConnectionId}`;
|
|
69
|
-
}
|
|
70
|
-
createRouteString(name) {
|
|
71
|
-
return `channel/${name}`;
|
|
72
|
-
}
|
|
73
|
-
createRtcPeer() {
|
|
74
|
-
return this.wire.environment.getRtcPeer();
|
|
75
|
-
}
|
|
76
|
-
async startClientOffer() {
|
|
77
|
-
// TODO replace with real guid.
|
|
78
|
-
const rtcConnectionId = Math.random().toString();
|
|
79
|
-
const rtcClient = this.createRtcPeer();
|
|
80
|
-
rtcClient.addEventListener('icecandidate', async (e) => {
|
|
81
|
-
var _a;
|
|
82
|
-
if (e.candidate) {
|
|
83
|
-
await this.raiseClientIce(rtcConnectionId, { candidate: (_a = e.candidate) === null || _a === void 0 ? void 0 : _a.toJSON() });
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
await this.listenForProviderIce(rtcConnectionId, async (payload) => {
|
|
87
|
-
await rtcClient.addIceCandidate(payload.candidate);
|
|
88
|
-
});
|
|
89
|
-
const channels = {
|
|
90
|
-
request: rtcClient.createDataChannel('request'),
|
|
91
|
-
response: rtcClient.createDataChannel('response')
|
|
92
|
-
};
|
|
93
|
-
const offer = await rtcClient.createOffer();
|
|
94
|
-
await rtcClient.setLocalDescription(offer);
|
|
95
|
-
const channelsOpened = Promise.all([channels.request, channels.response].map(this.ensureChannelOpened)).then(() => undefined);
|
|
96
|
-
return { rtcClient, channels, offer, rtcConnectionId, channelsOpened };
|
|
97
|
-
}
|
|
98
|
-
async finishClientOffer(rtcClient, answer, providerReady) {
|
|
99
|
-
await rtcClient.setRemoteDescription(answer);
|
|
100
|
-
await providerReady;
|
|
101
|
-
return true;
|
|
102
|
-
}
|
|
103
|
-
async createProviderAnswer(rtcConnectionId, offer) {
|
|
104
|
-
const rtcClient = this.createRtcPeer();
|
|
105
|
-
const requestChannelPromise = RTCICEManager.createDataChannelPromise('request', rtcClient);
|
|
106
|
-
const responseChannelPromise = RTCICEManager.createDataChannelPromise('response', rtcClient);
|
|
107
|
-
rtcClient.addEventListener('icecandidate', async (e) => {
|
|
108
|
-
var _a;
|
|
109
|
-
if (e.candidate) {
|
|
110
|
-
await this.raiseProviderIce(rtcConnectionId, { candidate: (_a = e.candidate) === null || _a === void 0 ? void 0 : _a.toJSON() });
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
await this.listenForClientIce(rtcConnectionId, async (payload) => {
|
|
114
|
-
await rtcClient.addIceCandidate(payload.candidate);
|
|
115
|
-
});
|
|
116
|
-
await rtcClient.setRemoteDescription(offer);
|
|
117
|
-
const answer = await rtcClient.createAnswer();
|
|
118
|
-
await rtcClient.setLocalDescription(answer);
|
|
119
|
-
const channels = Promise.all([requestChannelPromise, responseChannelPromise]).then(([request, response]) => {
|
|
120
|
-
// Clean up ice events.
|
|
121
|
-
this.cleanupIceListeners(rtcConnectionId);
|
|
122
|
-
return { request, response };
|
|
123
|
-
});
|
|
124
|
-
return {
|
|
125
|
-
rtcClient,
|
|
126
|
-
answer,
|
|
127
|
-
channels
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
exports.RTCICEManager = RTCICEManager;
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable class-methods-use-this */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.RTCICEManager = void 0;
|
|
5
|
+
const base_1 = require("../../../../base");
|
|
6
|
+
/*
|
|
7
|
+
Singleton that facilitates Offer and Answer exchange required for establishing RTC connections.
|
|
8
|
+
*/
|
|
9
|
+
class RTCICEManager extends base_1.EmitterBase {
|
|
10
|
+
constructor(wire) {
|
|
11
|
+
super(wire, 'channel');
|
|
12
|
+
this.ensureChannelOpened = (channel) => {
|
|
13
|
+
return new Promise((resolve, reject) => {
|
|
14
|
+
if (channel.readyState === 'open') {
|
|
15
|
+
resolve();
|
|
16
|
+
}
|
|
17
|
+
else if (channel.readyState === 'connecting') {
|
|
18
|
+
const listener = () => {
|
|
19
|
+
channel.removeEventListener('open', listener);
|
|
20
|
+
resolve();
|
|
21
|
+
};
|
|
22
|
+
channel.addEventListener('open', listener);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
reject(new Error('This Channel has already closed'));
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
static createDataChannelPromise(label, rtcClient) {
|
|
31
|
+
let resolver;
|
|
32
|
+
const promise = new Promise((resolve) => {
|
|
33
|
+
resolver = resolve;
|
|
34
|
+
});
|
|
35
|
+
const listener = (e) => {
|
|
36
|
+
const openListener = () => {
|
|
37
|
+
e.channel.removeEventListener('open', openListener);
|
|
38
|
+
resolver(e.channel);
|
|
39
|
+
};
|
|
40
|
+
if (e.channel.label === label) {
|
|
41
|
+
e.channel.addEventListener('open', openListener);
|
|
42
|
+
rtcClient.removeEventListener('datachannel', listener);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
rtcClient.addEventListener('datachannel', listener);
|
|
46
|
+
return promise;
|
|
47
|
+
}
|
|
48
|
+
async listenForProviderIce(rtcConnectionId, listener) {
|
|
49
|
+
await this.on(this.createProviderEventName(rtcConnectionId), listener, { timestamp: Date.now() });
|
|
50
|
+
}
|
|
51
|
+
async raiseProviderIce(rtcConnectionId, payload) {
|
|
52
|
+
await this.wire.environment.raiseEvent(this.createRouteString(this.createProviderEventName(rtcConnectionId)), payload);
|
|
53
|
+
}
|
|
54
|
+
async listenForClientIce(rtcConnectionId, listener) {
|
|
55
|
+
await this.on(this.createClientEventName(rtcConnectionId), listener, { timestamp: Date.now() });
|
|
56
|
+
}
|
|
57
|
+
async raiseClientIce(rtcConnectionId, payload) {
|
|
58
|
+
await this.wire.environment.raiseEvent(this.createRouteString(this.createClientEventName(rtcConnectionId)), payload);
|
|
59
|
+
}
|
|
60
|
+
cleanupIceListeners(rtcConnectionId) {
|
|
61
|
+
this.removeAllListeners(this.createClientEventName(rtcConnectionId));
|
|
62
|
+
this.removeAllListeners(this.createProviderEventName(rtcConnectionId));
|
|
63
|
+
}
|
|
64
|
+
createClientEventName(rtcConnectionId) {
|
|
65
|
+
return `ice-client-${rtcConnectionId}`;
|
|
66
|
+
}
|
|
67
|
+
createProviderEventName(rtcConnectionId) {
|
|
68
|
+
return `ice-provider-${rtcConnectionId}`;
|
|
69
|
+
}
|
|
70
|
+
createRouteString(name) {
|
|
71
|
+
return `channel/${name}`;
|
|
72
|
+
}
|
|
73
|
+
createRtcPeer() {
|
|
74
|
+
return this.wire.environment.getRtcPeer();
|
|
75
|
+
}
|
|
76
|
+
async startClientOffer() {
|
|
77
|
+
// TODO replace with real guid.
|
|
78
|
+
const rtcConnectionId = Math.random().toString();
|
|
79
|
+
const rtcClient = this.createRtcPeer();
|
|
80
|
+
rtcClient.addEventListener('icecandidate', async (e) => {
|
|
81
|
+
var _a;
|
|
82
|
+
if (e.candidate) {
|
|
83
|
+
await this.raiseClientIce(rtcConnectionId, { candidate: (_a = e.candidate) === null || _a === void 0 ? void 0 : _a.toJSON() });
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
await this.listenForProviderIce(rtcConnectionId, async (payload) => {
|
|
87
|
+
await rtcClient.addIceCandidate(payload.candidate);
|
|
88
|
+
});
|
|
89
|
+
const channels = {
|
|
90
|
+
request: rtcClient.createDataChannel('request'),
|
|
91
|
+
response: rtcClient.createDataChannel('response')
|
|
92
|
+
};
|
|
93
|
+
const offer = await rtcClient.createOffer();
|
|
94
|
+
await rtcClient.setLocalDescription(offer);
|
|
95
|
+
const channelsOpened = Promise.all([channels.request, channels.response].map(this.ensureChannelOpened)).then(() => undefined);
|
|
96
|
+
return { rtcClient, channels, offer, rtcConnectionId, channelsOpened };
|
|
97
|
+
}
|
|
98
|
+
async finishClientOffer(rtcClient, answer, providerReady) {
|
|
99
|
+
await rtcClient.setRemoteDescription(answer);
|
|
100
|
+
await providerReady;
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
async createProviderAnswer(rtcConnectionId, offer) {
|
|
104
|
+
const rtcClient = this.createRtcPeer();
|
|
105
|
+
const requestChannelPromise = RTCICEManager.createDataChannelPromise('request', rtcClient);
|
|
106
|
+
const responseChannelPromise = RTCICEManager.createDataChannelPromise('response', rtcClient);
|
|
107
|
+
rtcClient.addEventListener('icecandidate', async (e) => {
|
|
108
|
+
var _a;
|
|
109
|
+
if (e.candidate) {
|
|
110
|
+
await this.raiseProviderIce(rtcConnectionId, { candidate: (_a = e.candidate) === null || _a === void 0 ? void 0 : _a.toJSON() });
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
await this.listenForClientIce(rtcConnectionId, async (payload) => {
|
|
114
|
+
await rtcClient.addIceCandidate(payload.candidate);
|
|
115
|
+
});
|
|
116
|
+
await rtcClient.setRemoteDescription(offer);
|
|
117
|
+
const answer = await rtcClient.createAnswer();
|
|
118
|
+
await rtcClient.setLocalDescription(answer);
|
|
119
|
+
const channels = Promise.all([requestChannelPromise, responseChannelPromise]).then(([request, response]) => {
|
|
120
|
+
// Clean up ice events.
|
|
121
|
+
this.cleanupIceListeners(rtcConnectionId);
|
|
122
|
+
return { request, response };
|
|
123
|
+
});
|
|
124
|
+
return {
|
|
125
|
+
rtcClient,
|
|
126
|
+
answer,
|
|
127
|
+
channels
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
exports.RTCICEManager = RTCICEManager;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { ChannelStrategy } from '../strategy';
|
|
2
|
-
import { RTCPacket } from './endpoint';
|
|
3
|
-
import { LocalSupportedProtocol } from '..';
|
|
4
|
-
import ProviderIdentity = OpenFin.ProviderIdentity;
|
|
5
|
-
export interface RTCStrategyEndpointPayload {
|
|
6
|
-
endpointIdentity: OpenFin.ClientIdentity | ProviderIdentity;
|
|
7
|
-
rtc: RTCPacket;
|
|
8
|
-
}
|
|
9
|
-
export declare class RTCStrategy implements ChannelStrategy<RTCStrategyEndpointPayload> {
|
|
10
|
-
#private;
|
|
11
|
-
onEndpointDisconnect(endpointId: string, listener: () => void): void;
|
|
12
|
-
receive(listener: (action: string, payload: any, identity: OpenFin.ClientIdentity | OpenFin.ClientIdentityMultiRuntime | ProviderIdentity) => Promise<any>): void;
|
|
13
|
-
send: (endpointId: string, action: string, payload: any) => Promise<any>;
|
|
14
|
-
close: () => Promise<void>;
|
|
15
|
-
private getEndpointById;
|
|
16
|
-
get connected(): boolean;
|
|
17
|
-
isEndpointConnected(endpointId: string): boolean;
|
|
18
|
-
addEndpoint(endpointId: string, payload: RTCStrategyEndpointPayload): void;
|
|
19
|
-
closeEndpoint(endpointId: string): Promise<void>;
|
|
20
|
-
isValidEndpointPayload(payload: any): payload is RTCStrategyEndpointPayload;
|
|
21
|
-
}
|
|
22
|
-
export declare const RTCInfo: LocalSupportedProtocol;
|
|
1
|
+
import { ChannelStrategy } from '../strategy';
|
|
2
|
+
import { RTCPacket } from './endpoint';
|
|
3
|
+
import { LocalSupportedProtocol } from '..';
|
|
4
|
+
import ProviderIdentity = OpenFin.ProviderIdentity;
|
|
5
|
+
export interface RTCStrategyEndpointPayload {
|
|
6
|
+
endpointIdentity: OpenFin.ClientIdentity | ProviderIdentity;
|
|
7
|
+
rtc: RTCPacket;
|
|
8
|
+
}
|
|
9
|
+
export declare class RTCStrategy implements ChannelStrategy<RTCStrategyEndpointPayload> {
|
|
10
|
+
#private;
|
|
11
|
+
onEndpointDisconnect(endpointId: string, listener: () => void): void;
|
|
12
|
+
receive(listener: (action: string, payload: any, identity: OpenFin.ClientIdentity | OpenFin.ClientIdentityMultiRuntime | ProviderIdentity) => Promise<any>): void;
|
|
13
|
+
send: (endpointId: string, action: string, payload: any) => Promise<any>;
|
|
14
|
+
close: () => Promise<void>;
|
|
15
|
+
private getEndpointById;
|
|
16
|
+
get connected(): boolean;
|
|
17
|
+
isEndpointConnected(endpointId: string): boolean;
|
|
18
|
+
addEndpoint(endpointId: string, payload: RTCStrategyEndpointPayload): void;
|
|
19
|
+
closeEndpoint(endpointId: string): Promise<void>;
|
|
20
|
+
isValidEndpointPayload(payload: any): payload is RTCStrategyEndpointPayload;
|
|
21
|
+
}
|
|
22
|
+
export declare const RTCInfo: LocalSupportedProtocol;
|