Skip to content

Commit

Permalink
add "with custom server logic" to the "Proxying WebSockets" section o…
Browse files Browse the repository at this point in the history
…f the readme.md
  • Loading branch information
sergioramos committed Nov 8, 2012
1 parent 8a88774 commit 03dbe11
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 03dbe11

Please sign in to comment.