@openfin/remote-adapter 45.100.76 → 45.100.78

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.
@@ -10291,7 +10291,16 @@ class RTCEndpoint {
10291
10291
  const promise = new Promise((resolve, reject) => {
10292
10292
  this.responseMap.set(messageId, { resolve, reject });
10293
10293
  });
10294
- this.rtc.channels.request.send(JSON.stringify({ action, payload, messageId }));
10294
+ try {
10295
+ this.rtc.channels.request.send(JSON.stringify({ action, payload, messageId }));
10296
+ }
10297
+ catch {
10298
+ // Chromium 149+ throws TypeError for messages exceeding
10299
+ // RTCSctpTransport.maxMessageSize instead of passing them to
10300
+ // the SCTP layer (which would close the channel and fire onclose).
10301
+ // Replicate the pre-149 close-and-disconnect behavior.
10302
+ this.disconnectOnSendFailure();
10303
+ }
10295
10304
  return promise;
10296
10305
  };
10297
10306
  this.close = () => {
@@ -10333,7 +10342,7 @@ class RTCEndpoint {
10333
10342
  if (__classPrivateFieldGet$g(this, _RTCEndpoint_processAction, "f")) {
10334
10343
  try {
10335
10344
  const res = await __classPrivateFieldGet$g(this, _RTCEndpoint_processAction, "f").call(this, action, payload, endpointIdentity);
10336
- this.rtc.channels.response.send(JSON.stringify({
10345
+ this.sendResponse(JSON.stringify({
10337
10346
  messageId,
10338
10347
  payload: res,
10339
10348
  success: true
@@ -10343,7 +10352,7 @@ class RTCEndpoint {
10343
10352
  // Check if RTCDataChannel is open before sending, error gets swallowed here in the case where
10344
10353
  // client dispatched then closed or disconnected before the dispatch resolves.
10345
10354
  if (this.rtc.channels.response.readyState === 'open') {
10346
- this.rtc.channels.response.send(JSON.stringify({
10355
+ this.sendResponse(JSON.stringify({
10347
10356
  messageId,
10348
10357
  error: errorToPOJO(error),
10349
10358
  success: false
@@ -10353,7 +10362,7 @@ class RTCEndpoint {
10353
10362
  // Check if RTCDataChannel is open for same reason as catch block above.
10354
10363
  }
10355
10364
  else if (this.rtc.channels.response.readyState === 'open') {
10356
- this.rtc.channels.response.send(JSON.stringify({
10365
+ this.sendResponse(JSON.stringify({
10357
10366
  messageId,
10358
10367
  success: false,
10359
10368
  error: 'Connection not ready.'
@@ -10386,6 +10395,26 @@ class RTCEndpoint {
10386
10395
  }
10387
10396
  __classPrivateFieldSet$f(this, _RTCEndpoint_processAction, listener, "f");
10388
10397
  }
10398
+ sendResponse(data) {
10399
+ try {
10400
+ this.rtc.channels.response.send(data);
10401
+ }
10402
+ catch {
10403
+ this.disconnectOnSendFailure();
10404
+ }
10405
+ }
10406
+ disconnectOnSendFailure() {
10407
+ // Clear onclose handlers to prevent double-firing the disconnect cascade
10408
+ // (closing channels below would otherwise re-trigger them).
10409
+ Object.values(this.rtc.channels).forEach((dc) => {
10410
+ dc.onclose = null;
10411
+ });
10412
+ [...this.responseMap.values()].forEach((p) => p.reject(new Error('RTCDataChannel closed unexpectedly, this is most commonly caused by message size. Note: RTC Channels have a message size limit of ~255kB.')));
10413
+ this.close();
10414
+ if (__classPrivateFieldGet$g(this, _RTCEndpoint_disconnectListener, "f")) {
10415
+ __classPrivateFieldGet$g(this, _RTCEndpoint_disconnectListener, "f").call(this);
10416
+ }
10417
+ }
10389
10418
  get connected() {
10390
10419
  return this.rtc.rtcClient.connectionState === 'connected';
10391
10420
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/remote-adapter",
3
- "version": "45.100.76",
3
+ "version": "45.100.78",
4
4
  "description": "Establish intermachine runtime connections using webRTC.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "private": false,
@@ -16,7 +16,7 @@
16
16
  "dependencies": {
17
17
  "es-toolkit": "^1.39.3",
18
18
  "tslib": "2.8.1",
19
- "@openfin/core": "45.100.76"
19
+ "@openfin/core": "45.100.78"
20
20
  },
21
21
  "scripts": {
22
22
  "prebuild": "rimraf ./out",