Skip to content

Commit

Permalink
Merge pull request #332 from ramitos/patch-1
Browse files Browse the repository at this point in the history
add "with custom server logic" to the "Proxying WebSockets" section of the readme
  • Loading branch information
indexzero committed Mar 9, 2013
2 parents c6da760 + 03dbe11 commit eee6bab
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 @@ -463,6 +463,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 eee6bab

Please sign in to comment.