Skip to content

Commit 05d18a4

Browse files
jleal52jcrugzz
authored andcommitted
Update README.md
1 parent 8bff3dd commit 05d18a4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ http.createServer(function (req, res) {
196196
* `error`: The error event is emitted if the request to the target fail.
197197
* `proxyRes`: This event is emitted if the request to the target got a response.
198198
* `proxySocket`: This event is emitted once the proxy websocket was created and piped into the target websocket.
199+
* `close`: This event is emitted once the proxy websocket was closed.
199200

200201
```js
201202
var httpProxy = require('http-proxy');
@@ -233,6 +234,14 @@ proxy.on('proxySocket', function (proxySocket) {
233234
// listen for messages coming FROM the target here
234235
proxySocket.on('data', hybiParseAndLogMessage);
235236
});
237+
238+
//
239+
// Listen for the `close` event on `proxy`.
240+
//
241+
proxy.on('close', function (req, socket, head) {
242+
// view disconnected websocket connections
243+
console.log('Client disconnected');
244+
});
236245
```
237246

238247
#### Using HTTPS

0 commit comments

Comments
 (0)