HenningM/express-ws — pull request #5 by qiangyee (2014-12-15 11:00:26+00:00)
Title: Add err into next fuction

When use connect-timeout plugins, the router will execute twice.

Server:
```javascript
var express = require('express');
var timeout = require('connect-timeout');
var app = express();
var expressWs = require('express-ws');
var http = require('http');

function main(cb) {

app.use(timeout('5s'));

app.use(haltOnTimedout);

var server = http.createServer(app);

expressWs(app, server);
// Listen on http port.
server.listen(app.get('port'), function () {
cb(server, app);
});

}

function haltOnTimedout(req, res, next) {
if (!req.timedout) next();
}

app.ws('/echo', function(ws, req){
// 5s later, this will execute once again
console.log('execute twice');
});

main(function(){
console.log('start');
});

```