Compare commits

...

2 Commits

Author SHA1 Message Date
90e1a0453e 3.0.21 2022-07-30 19:28:24 +02:00
d7765fb5dc fix(core): update 2022-07-30 19:28:23 +02:00
4 changed files with 37 additions and 33 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "@pushrocks/smartproxy", "name": "@pushrocks/smartproxy",
"version": "3.0.20", "version": "3.0.21",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@pushrocks/smartproxy", "name": "@pushrocks/smartproxy",
"version": "3.0.20", "version": "3.0.21",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@pushrocks/lik": "^6.0.0", "@pushrocks/lik": "^6.0.0",

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartproxy", "name": "@pushrocks/smartproxy",
"version": "3.0.20", "version": "3.0.21",
"private": false, "private": false,
"description": "a proxy for handling high workloads of proxying", "description": "a proxy for handling high workloads of proxying",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@pushrocks/smartproxy', name: '@pushrocks/smartproxy',
version: '3.0.20', version: '3.0.21',
description: 'a proxy for handling high workloads of proxying' description: 'a proxy for handling high workloads of proxying'
} }

View File

@ -234,8 +234,11 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
const wss = new plugins.ws.WebSocketServer({ server: this.httpsServer }); const wss = new plugins.ws.WebSocketServer({ server: this.httpsServer });
wss.on('connection', (ws: plugins.wsDefault) => { wss.on('connection', (ws: plugins.wsDefault) => {
console.log('got connection for wsc'); console.log('got connection for wsc');
const wscConnected = plugins.smartpromise.defer(); let wscConnectedDeferred: plugins.smartpromise.Deferred<plugins.wsDefault>;
ws.on('message', async (message) => {
if (!wscConnectedDeferred) {
wscConnectedDeferred = plugins.smartpromise.defer();
const wsc = new plugins.wsDefault(this.router.routeWs(ws), { const wsc = new plugins.wsDefault(this.router.routeWs(ws), {
headers: { headers: {
Host: ws.url, Host: ws.url,
@ -243,13 +246,11 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
}); });
wsc.on('open', () => { wsc.on('open', () => {
wscConnected.resolve(); wscConnectedDeferred.resolve(wsc);
}); });
}
ws.on('message', async (message) => { const wsc = await wscConnectedDeferred.promise;
await wscConnected.promise;
wsc.emit('message', message); wsc.emit('message', message);
});
wsc.on('message', (message) => { wsc.on('message', (message) => {
ws.emit('message', message); ws.emit('message', message);
}); });
@ -265,10 +266,13 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
ws.on('close', (message) => { ws.on('close', (message) => {
cleanUp(); cleanUp();
}); });
wsc.on('close', (message) => { wsc.on('close', (message) => {
cleanUp(); cleanUp();
}); });
}); });
});
this.httpsServer.keepAliveTimeout = 61000; this.httpsServer.keepAliveTimeout = 61000;
this.httpsServer.headersTimeout = 65000; this.httpsServer.headersTimeout = 65000;