I created a proxy to redirect websocket connections to another websocket server like:
websocket client <-----> proxy <-----> websocket target server
In order to control the messages that sent from client to the sever, I would like to know what messages are sent to the server and do some filtering. I found the following codes helping me to get the sent messages but I can't filter the unwanted messages (such as 'hello'). Is there another method I can use to add some logic before the messages are sent to target server ?
proxy.on('proxyReqWs', function(proxyReq, req, socket, res, options) {
var parser = new WsParser(0, false);
socket.pipe(parser);
parser.on('frame', function (frame) {
// handle the frame
console.log('Up:',frame);
console.log('Up data:'+frame.data);
});
});
I created a proxy to redirect websocket connections to another websocket server like: websocket client <-----> proxy <-----> websocket target server
In order to control the messages that sent from client to the sever, I would like to know what messages are sent to the server and do some filtering. I found the following codes helping me to get the sent messages but I can't filter the unwanted messages (such as 'hello'). Is there another method I can use to add some logic before the messages are sent to target server ?
proxy.on('proxyReqWs', function(proxyReq, req, socket, res, options) { var parser = new WsParser(0, false); socket.pipe(parser); parser.on('frame', function (frame) { // handle the frame console.log('Up:',frame); console.log('Up data:'+frame.data); });
});