fix(core): update
This commit is contained in:
		| @@ -3,6 +3,6 @@ | ||||
|  */ | ||||
| export const commitinfo = { | ||||
|   name: '@pushrocks/smartproxy', | ||||
|   version: '3.0.53', | ||||
|   version: '3.0.54', | ||||
|   description: 'a proxy for handling high workloads of proxying' | ||||
| } | ||||
|   | ||||
| @@ -245,32 +245,32 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g= | ||||
|     ); | ||||
|  | ||||
|     // Enable websockets | ||||
|     const wss = new plugins.ws.WebSocketServer({ server: this.httpsServer  }); | ||||
|     wss.on('connection', async (ws: plugins.wsDefault, reqArg: plugins.http.IncomingMessage) => { | ||||
|     const wsServer = new plugins.ws.WebSocketServer({ server: this.httpsServer  }); | ||||
|     wsServer.on('connection', async (wsIncoming: plugins.wsDefault, reqArg: plugins.http.IncomingMessage) => { | ||||
|       console.log(`wss: got connection for wsc for https://${reqArg.headers.host}${reqArg.url}`); | ||||
|        | ||||
|       let wsc: plugins.wsDefault; | ||||
|       let wsOutgoing: plugins.wsDefault; | ||||
|       try { | ||||
|         wsc = new plugins.wsDefault(`ws://${this.router.routeReq(reqArg).destinationIp}:${this.router.routeReq(reqArg).destinationPort}${reqArg.url}`); | ||||
|         wsOutgoing = new plugins.wsDefault(`ws://${this.router.routeReq(reqArg).destinationIp}:${this.router.routeReq(reqArg).destinationPort}${reqArg.url}`); | ||||
|       } catch (err) { | ||||
|         console.log(err); | ||||
|         ws.terminate(); | ||||
|         wsIncoming.terminate(); | ||||
|         return; | ||||
|       } | ||||
|  | ||||
|       ws.on("message", (message, isBinary) => { | ||||
|       wsIncoming.on("message", (message, isBinary) => { | ||||
|         console.log("client to upstream", message); | ||||
|         wsc.send(message, { binary: isBinary }); | ||||
|         wsOutgoing.send(message, { binary: isBinary }); | ||||
|       }); | ||||
|      | ||||
|       wsc.on("message", (message, isBinary) => { | ||||
|       wsOutgoing.on("message", (message, isBinary) => { | ||||
|         console.log("upstream to client", message); | ||||
|         ws.send(message, { binary: isBinary }); | ||||
|         wsIncoming.send(message, { binary: isBinary }); | ||||
|       }); | ||||
|       ws.on("error", () => wsc.terminate()); | ||||
|       wsc.on("error", () => ws.terminate()); | ||||
|       ws.on("close", () => wsc.terminate()); | ||||
|       wsc.on("close", () => ws.terminate()); | ||||
|       wsIncoming.on("error", () => wsOutgoing.terminate()); | ||||
|       wsOutgoing.on("error", () => wsIncoming.terminate()); | ||||
|       wsIncoming.on("close", () => wsOutgoing.terminate()); | ||||
|       wsOutgoing.on("close", () => wsIncoming.terminate()); | ||||
|  | ||||
|     }); | ||||
|     this.httpsServer.keepAliveTimeout = 600 * 1000; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user