You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-8Lines changed: 9 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -395,27 +395,28 @@ proxyServer.listen(8015);
395
395
396
396
};
397
397
```
398
-
* **wsInterceptServerMsg**: Is a handler which is called when a websocket message is intercepted on its way to the server. It takes two arguments: `data` - is a websocket message and flags (fin, mask, compress, binary). If falsy value is returned then nothing will be sended to the target server.
399
-
```
398
+
* **wsInterceptClientMsg**: Is a handler which is called when a websocket message is intercepted on its way to the server from the client. It takes two arguments: `data` - is a websocket message and flags (fin, mask, compress, binary). If falsy value is returned then nothing will be sended to the client.
399
+
```
400
400
const proxy = new HttpProxy({
401
401
...
402
-
wsInterceptServerMsg: (data, flags) {
402
+
wsInterceptClientMsg: (data, flags) {
403
403
return typeof data === 'string ? data.toUpperCase() : data;
404
404
}
405
405
...
406
406
})
407
407
```
408
-
* **wsInterceptClientMsg**: Is a handler which is called when a websocket message is intercepted on its way to the client. It takes two arguments: `data` - is a websocket message and flags (fin, mask, compress, binary). If falsy value is returned then nothing will be sended to the client.
409
-
```
408
+
* **wsInterceptServerMsg**: Is a handler which is called when a websocket message is intercepted on its way to the client from the server. It takes two arguments: `data` - is a websocket message and flags (fin, mask, compress, binary). If falsy value is returned then nothing will be sended to the target server.
409
+
```
410
410
const proxy = new HttpProxy({
411
411
...
412
-
wsInterceptClientMsg: (data, flags) {
412
+
wsInterceptServerMsg: (data, flags) {
413
413
return typeof data === 'string ? data.toUpperCase() : data;
414
414
}
415
415
...
416
416
})
417
417
```
418
418
419
+
419
420
**NOTE:**
420
421
`options.ws` and `options.ssl` are optional.
421
422
`options.target` and `options.forward` cannot both be missing
@@ -434,8 +435,8 @@ If you are using the `proxyServer.listen` method, the following options are also
434
435
* `proxyReq`: This event is emitted before the data is sent. It gives you a chance to alter the proxyReq request object. Applies to "web" connections
435
436
* `proxyReqWs`: This event is emitted before the data is sent. It gives you a chance to alter the proxyReq request object. Applies to "websocket" connections
436
437
* `proxyRes`: This event is emitted if the request to the target got a response.
437
-
* `wsServerMsg`: This event is emitted after websocket message is sended to the server.
438
-
* `wsClientMsg`: This event is emitted after webscoket mesage is sended to the client.
438
+
* `wsClientMsg`: This event is emitted after webscoket mesage is sended from the client to the server.
439
+
* `wsServerMsg`: This event is emitted after websocket message is sended from the server to the client.
439
440
* `open`: This event is emitted once the proxy websocket was created and piped into the target websocket.
440
441
* `close`: This event is emitted once the proxy websocket was closed.
441
442
* (DEPRECATED) `proxySocket`: Deprecated in favor of `open`.
0 commit comments