Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifying the websocket sent message #1203

Open
conradkao opened this issue Sep 20, 2017 · 1 comment
Open

Modifying the websocket sent message #1203

conradkao opened this issue Sep 20, 2017 · 1 comment

Comments

@conradkao
Copy link

conradkao commented Sep 20, 2017

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);
});
});

@thjaeckle
Copy link

@conradkao did you ever manage to get this working? I want to do the same and only got it working logging the websocket frames..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants