Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
ee4f7fc48d | |||
f6e656361b | |||
e51c2a88cc | |||
7f8112930d |
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartproxy",
|
"name": "@pushrocks/smartproxy",
|
||||||
"version": "3.0.54",
|
"version": "3.0.56",
|
||||||
"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",
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@pushrocks/smartproxy',
|
name: '@pushrocks/smartproxy',
|
||||||
version: '3.0.54',
|
version: '3.0.56',
|
||||||
description: 'a proxy for handling high workloads of proxying'
|
description: 'a proxy for handling high workloads of proxying'
|
||||||
}
|
}
|
||||||
|
@ -247,11 +247,12 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
|
|||||||
// Enable websockets
|
// Enable websockets
|
||||||
const wsServer = new plugins.ws.WebSocketServer({ server: this.httpsServer });
|
const wsServer = new plugins.ws.WebSocketServer({ server: this.httpsServer });
|
||||||
wsServer.on('connection', async (wsIncoming: plugins.wsDefault, reqArg: plugins.http.IncomingMessage) => {
|
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}`);
|
console.log(`wss proxy: got connection for wsc for https://${reqArg.headers.host}${reqArg.url}`);
|
||||||
|
|
||||||
let wsOutgoing: plugins.wsDefault;
|
let wsOutgoing: plugins.wsDefault;
|
||||||
try {
|
try {
|
||||||
wsOutgoing = 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}`);
|
||||||
|
console.log('wss proxy: initiated outgoing proxy')
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
wsIncoming.terminate();
|
wsIncoming.terminate();
|
||||||
@ -259,12 +260,12 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
|
|||||||
}
|
}
|
||||||
|
|
||||||
wsIncoming.on("message", (message, isBinary) => {
|
wsIncoming.on("message", (message, isBinary) => {
|
||||||
console.log("client to upstream", message);
|
// console.log("client to upstream", message);
|
||||||
wsOutgoing.send(message, { binary: isBinary });
|
wsOutgoing.send(message, { binary: isBinary });
|
||||||
});
|
});
|
||||||
|
|
||||||
wsOutgoing.on("message", (message, isBinary) => {
|
wsOutgoing.on("message", (message, isBinary) => {
|
||||||
console.log("upstream to client", message);
|
// console.log("upstream to client", message);
|
||||||
wsIncoming.send(message, { binary: isBinary });
|
wsIncoming.send(message, { binary: isBinary });
|
||||||
});
|
});
|
||||||
wsIncoming.on("error", () => wsOutgoing.terminate());
|
wsIncoming.on("error", () => wsOutgoing.terminate());
|
||||||
|
Reference in New Issue
Block a user