ws-process 0.3.37 → 0.3.39
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/index.js +20 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable import/no-unresolved */
|
|
2
2
|
// ws-process.js
|
|
3
3
|
import axios from 'axios';
|
|
4
|
+
import * as Sentry from '@sentry/react';
|
|
4
5
|
import {
|
|
5
6
|
defined, clone, makeid, tryit,
|
|
6
7
|
} from '@bsgp/lib-core';
|
|
@@ -725,14 +726,33 @@ function asyncSend(msg) {
|
|
|
725
726
|
}
|
|
726
727
|
}
|
|
727
728
|
|
|
729
|
+
if (['requestodata', 'requestsoap'].includes(jsonMSG.action)) {
|
|
730
|
+
jsonMSG.compressAsGzip = true;
|
|
731
|
+
}
|
|
732
|
+
|
|
728
733
|
console.log('%csending message:', 'color:green', jsonMSG);
|
|
729
734
|
const wsMSG = JSON.stringify(jsonMSG);
|
|
730
735
|
|
|
731
736
|
const frameSize = Math.floor(1024 * 32 * 0.9);
|
|
732
737
|
const refinedMSG = cutStringByLength(wsMSG, frameSize);
|
|
738
|
+
|
|
733
739
|
if (refinedMSG.length === 1) {
|
|
734
740
|
local.wsProcess.wSocket.send(wsMSG);
|
|
735
741
|
} else {
|
|
742
|
+
try {
|
|
743
|
+
const transaction = Sentry.startInactiveSpan({
|
|
744
|
+
name: 'Split Request Payload',
|
|
745
|
+
op: 'onSplitReqPayload',
|
|
746
|
+
data: {
|
|
747
|
+
payload: jsonMSG,
|
|
748
|
+
},
|
|
749
|
+
});
|
|
750
|
+
transaction.finish();
|
|
751
|
+
// Finishing the transaction will send it to Sentry
|
|
752
|
+
} catch (ex) {
|
|
753
|
+
console.log('sentry ex:', ex);
|
|
754
|
+
}
|
|
755
|
+
|
|
736
756
|
const srcIndicator = getRandomID();
|
|
737
757
|
const payloadArr = createSplitPayload(refinedMSG, srcIndicator, jsonMSG);
|
|
738
758
|
payloadArr.forEach((eachMSG) => {
|