fix(core): update
This commit is contained in:
parent
0fdd17b430
commit
d7765fb5dc
@ -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'
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user