fix(core): update
This commit is contained in:
parent
9b1ff5eed8
commit
972ee2af54
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@pushrocks/smartproxy',
|
||||
version: '3.0.57',
|
||||
version: '3.0.58',
|
||||
description: 'a proxy for handling high workloads of proxying'
|
||||
}
|
||||
|
@ -250,21 +250,28 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
|
||||
console.log(`wss proxy: got connection for wsc for https://${reqArg.headers.host}${reqArg.url}`);
|
||||
|
||||
let wsOutgoing: plugins.wsDefault;
|
||||
|
||||
const outGoingDeferred = plugins.smartpromise.defer();
|
||||
|
||||
try {
|
||||
wsOutgoing = new plugins.wsDefault(`ws://${this.router.routeReq(reqArg).destinationIp}:${this.router.routeReq(reqArg).destinationPort}${reqArg.url}`);
|
||||
console.log('wss proxy: initiated outgoing proxy')
|
||||
console.log('wss proxy: initiated outgoing proxy');
|
||||
wsOutgoing.on('open', async () => {
|
||||
outGoingDeferred.resolve();
|
||||
})
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
wsIncoming.terminate();
|
||||
return;
|
||||
}
|
||||
|
||||
wsIncoming.on("message", (message, isBinary) => {
|
||||
wsIncoming.on("message", async (message, isBinary) => {
|
||||
await outGoingDeferred.promise;
|
||||
// console.log("client to upstream", message);
|
||||
wsOutgoing.send(message, { binary: isBinary });
|
||||
});
|
||||
|
||||
wsOutgoing.on("message", (message, isBinary) => {
|
||||
wsOutgoing.on("message", async (message, isBinary) => {
|
||||
// console.log("upstream to client", message);
|
||||
wsIncoming.send(message, { binary: isBinary });
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user