From 03dbe115c2b088737e5b9abcadf91a8298f56f1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Ramos?= Date: Thu, 8 Nov 2012 09:47:44 +0000 Subject: [PATCH] add "with custom server logic" to the "Proxying WebSockets" section of the readme.md --- README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/README.md b/README.md index fdedc3aba..756f4abda 100644 --- a/README.md +++ b/README.md @@ -444,6 +444,34 @@ server.on('upgrade', function(req, socket, head) { server.listen(8080); ``` +### with custom server logic + +``` js +var httpProxy = require('http-proxy') + +var server = httpProxy.createServer(function (req, res, proxy) { + // + // Put your custom server logic here + // + proxy.proxyRequest(req, res, { + host: 'localhost', + port: 9000 + }); +}) + +server.on('upgrade', function(req, socket, head) { + // + // Put your custom server logic here + // + proxy.proxyWebSocketRequest(req, socket, head, { + host: 'localhost', + port: 9000 + }); +}); + +server.listen(8080); +``` + ### Configuring your Socket limits By default, `node-http-proxy` will set a 100 socket limit for all `host:port` proxy targets. You can change this in two ways: