Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
a1c4f3c341 | |||
8087bab197 | |||
db63e7bf79 | |||
2615a0ebd4 | |||
d5d77af98d | |||
1f1bf77807 | |||
d4269d290d | |||
e05e5ede55 | |||
b6c7f13baa | |||
055d328bd0 |
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartproxy",
|
||||
"version": "3.0.43",
|
||||
"version": "3.0.48",
|
||||
"private": false,
|
||||
"description": "a proxy for handling high workloads of proxying",
|
||||
"main": "dist_ts/index.js",
|
||||
|
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@pushrocks/smartproxy',
|
||||
version: '3.0.43',
|
||||
version: '3.0.48',
|
||||
description: 'a proxy for handling high workloads of proxying'
|
||||
}
|
||||
|
@ -246,14 +246,21 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
|
||||
|
||||
// Enable websockets
|
||||
const wss = new plugins.ws.WebSocketServer({ server: this.httpsServer });
|
||||
wss.on('connection', (ws: plugins.wsDefault, reqArg) => {
|
||||
console.log(`got connection for wsc for https://${req.get('host')}${reqArg.url}`);
|
||||
wss.on('connection', (ws: plugins.wsDefault, reqArg: plugins.http.IncomingMessage) => {
|
||||
console.log(`got connection for wsc for https://${reqArg.headers.host}${reqArg.url}`);
|
||||
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.routeReq(reqArg)}${reqArg.url}`);
|
||||
let wsc;
|
||||
try {
|
||||
wsc = new plugins.wsDefault(`wss://${this.router.routeReq(reqArg).destinationIp}:${this.router.routeReq(reqArg).destinationPort}${reqArg.url}`);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
ws.terminate();
|
||||
return;
|
||||
}
|
||||
|
||||
wsc.on('open', () => {
|
||||
wscConnectedDeferred.resolve(wsc);
|
||||
|
Reference in New Issue
Block a user