fix(core): update

This commit is contained in:
Philipp Kunz 2023-01-05 20:15:16 +01:00
parent 32c6d77178
commit 392e241208
2 changed files with 6 additions and 7 deletions

View File

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

View File

@ -247,7 +247,7 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
// Enable websockets // Enable websockets
const wss = new plugins.ws.WebSocketServer({ server: this.httpsServer }); const wss = new plugins.ws.WebSocketServer({ server: this.httpsServer });
wss.on('connection', (ws: plugins.wsDefault, reqArg: plugins.http.IncomingMessage) => { wss.on('connection', (ws: plugins.wsDefault, reqArg: plugins.http.IncomingMessage) => {
console.log(`got connection for wsc for https://${reqArg.headers.host}${reqArg.url}`); console.log(`wss: got connection for wsc for https://${reqArg.headers.host}${reqArg.url}`);
let wscConnectedDeferred: plugins.smartpromise.Deferred<plugins.wsDefault>; let wscConnectedDeferred: plugins.smartpromise.Deferred<plugins.wsDefault>;
ws.on('message', async (message) => { ws.on('message', async (message) => {
@ -263,17 +263,16 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
ws.terminate(); ws.terminate();
return; return;
} }
wsc.on('open', () => { wsc.on('open', () => {
console.log('wsc opened.');
wscConnectedDeferred.resolve(wsc); wscConnectedDeferred.resolve(wsc);
}); });
wsc.on('message', (message) => {
ws.send(message);
});
} }
const wsc = await wscConnectedDeferred.promise; const wsc = await wscConnectedDeferred.promise;
wsc.send(message); wsc.send(message);
wsc.on('message', (message) => {
ws.send(message);
});
// handle closing // handle closing
const cleanUp = () => { const cleanUp = () => {
ws.terminate(); ws.terminate();