@openfin/node-adapter 45.100.75 → 45.100.77

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.
@@ -7741,7 +7741,16 @@ class RTCEndpoint {
7741
7741
  const promise = new Promise((resolve, reject) => {
7742
7742
  this.responseMap.set(messageId, { resolve, reject });
7743
7743
  });
7744
- this.rtc.channels.request.send(JSON.stringify({ action, payload, messageId }));
7744
+ try {
7745
+ this.rtc.channels.request.send(JSON.stringify({ action, payload, messageId }));
7746
+ }
7747
+ catch {
7748
+ // Chromium 149+ throws TypeError for messages exceeding
7749
+ // RTCSctpTransport.maxMessageSize instead of passing them to
7750
+ // the SCTP layer (which would close the channel and fire onclose).
7751
+ // Replicate the pre-149 close-and-disconnect behavior.
7752
+ this.disconnectOnSendFailure();
7753
+ }
7745
7754
  return promise;
7746
7755
  };
7747
7756
  this.close = () => {
@@ -7783,7 +7792,7 @@ class RTCEndpoint {
7783
7792
  if (__classPrivateFieldGet$i(this, _RTCEndpoint_processAction, "f")) {
7784
7793
  try {
7785
7794
  const res = await __classPrivateFieldGet$i(this, _RTCEndpoint_processAction, "f").call(this, action, payload, endpointIdentity);
7786
- this.rtc.channels.response.send(JSON.stringify({
7795
+ this.sendResponse(JSON.stringify({
7787
7796
  messageId,
7788
7797
  payload: res,
7789
7798
  success: true
@@ -7793,7 +7802,7 @@ class RTCEndpoint {
7793
7802
  // Check if RTCDataChannel is open before sending, error gets swallowed here in the case where
7794
7803
  // client dispatched then closed or disconnected before the dispatch resolves.
7795
7804
  if (this.rtc.channels.response.readyState === 'open') {
7796
- this.rtc.channels.response.send(JSON.stringify({
7805
+ this.sendResponse(JSON.stringify({
7797
7806
  messageId,
7798
7807
  error: errorToPOJO(error),
7799
7808
  success: false
@@ -7803,7 +7812,7 @@ class RTCEndpoint {
7803
7812
  // Check if RTCDataChannel is open for same reason as catch block above.
7804
7813
  }
7805
7814
  else if (this.rtc.channels.response.readyState === 'open') {
7806
- this.rtc.channels.response.send(JSON.stringify({
7815
+ this.sendResponse(JSON.stringify({
7807
7816
  messageId,
7808
7817
  success: false,
7809
7818
  error: 'Connection not ready.'
@@ -7836,6 +7845,26 @@ class RTCEndpoint {
7836
7845
  }
7837
7846
  __classPrivateFieldSet$h(this, _RTCEndpoint_processAction, listener, "f");
7838
7847
  }
7848
+ sendResponse(data) {
7849
+ try {
7850
+ this.rtc.channels.response.send(data);
7851
+ }
7852
+ catch {
7853
+ this.disconnectOnSendFailure();
7854
+ }
7855
+ }
7856
+ disconnectOnSendFailure() {
7857
+ // Clear onclose handlers to prevent double-firing the disconnect cascade
7858
+ // (closing channels below would otherwise re-trigger them).
7859
+ Object.values(this.rtc.channels).forEach((dc) => {
7860
+ dc.onclose = null;
7861
+ });
7862
+ [...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.')));
7863
+ this.close();
7864
+ if (__classPrivateFieldGet$i(this, _RTCEndpoint_disconnectListener, "f")) {
7865
+ __classPrivateFieldGet$i(this, _RTCEndpoint_disconnectListener, "f").call(this);
7866
+ }
7867
+ }
7839
7868
  get connected() {
7840
7869
  return this.rtc.rtcClient.connectionState === 'connected';
7841
7870
  }
@@ -17286,7 +17315,7 @@ class NodeEnvironment extends BaseEnvironment {
17286
17315
  };
17287
17316
  }
17288
17317
  getAdapterVersionSync() {
17289
- return "45.100.75";
17318
+ return "45.100.77";
17290
17319
  }
17291
17320
  observeBounds(element, onChange) {
17292
17321
  throw new Error('Method not implemented.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/node-adapter",
3
- "version": "45.100.75",
3
+ "version": "45.100.77",
4
4
  "description": "See README.md",
5
5
  "main": "out/node-adapter.js",
6
6
  "types": "out/node-adapter.d.ts",
@@ -20,7 +20,7 @@
20
20
  "es-toolkit": "^1.39.3",
21
21
  "ws": "^7.5.10",
22
22
  "tslib": "2.8.1",
23
- "@openfin/core": "45.100.75"
23
+ "@openfin/core": "45.100.77"
24
24
  },
25
25
  "scripts": {
26
26
  "prebuild": "rimraf ./out",