Update README.md

This commit is contained in:
Jorge 2014-12-11 15:19:56 +01:00 committed by Jarrett Cruger
parent 8bff3ddc12
commit 05d18a4e1b

View File

@ -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