From 05d18a4e1ba6c2de41b0b803cd1793357979384d Mon Sep 17 00:00:00 2001 From: Jorge Date: Thu, 11 Dec 2014 15:19:56 +0100 Subject: [PATCH] Update README.md --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 2eec2c5..aaf2f69 100644 --- a/README.md +++ b/README.md @@ -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