mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
Update README.md
This commit is contained in:
parent
8bff3ddc12
commit
05d18a4e1b
@ -196,6 +196,7 @@ http.createServer(function (req, res) {
|
||||
* `error`: The error event is emitted if the request to the target fail.
|
||||
* `proxyRes`: This event is emitted if the request to the target got a response.
|
||||
* `proxySocket`: This event is emitted once the proxy websocket was created and piped into the target websocket.
|
||||
* `close`: This event is emitted once the proxy websocket was closed.
|
||||
|
||||
```js
|
||||
var httpProxy = require('http-proxy');
|
||||
@ -233,6 +234,14 @@ proxy.on('proxySocket', function (proxySocket) {
|
||||
// listen for messages coming FROM the target here
|
||||
proxySocket.on('data', hybiParseAndLogMessage);
|
||||
});
|
||||
|
||||
//
|
||||
// Listen for the `close` event on `proxy`.
|
||||
//
|
||||
proxy.on('close', function (req, socket, head) {
|
||||
// view disconnected websocket connections
|
||||
console.log('Client disconnected');
|
||||
});
|
||||
```
|
||||
|
||||
#### Using HTTPS
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user