kevbob650
asked on
NodeJS Timing Out
I have a node js server using express and socket.io. I found a function I would love to try but not sure how to write the code. The code below is written using http.createServer, but since I'm using express, it's not the same format and I don't know how to write this???
How I create the server....
var express = require('/usr/lib/node_mod ules/expre ss');
var app = express();
var server = require('http').Server(app );
The functionality I would like to duplicate....
http.createServer(function (req, res) {
res.socket.setTimeout(10);
res.socket.removeAllListen ers('timeo ut');
res.socket.once('timeout', function () {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
});
}).listen(8888);
Any help would be appreciated!
How I create the server....
var express = require('/usr/lib/node_mod
var app = express();
var server = require('http').Server(app
The functionality I would like to duplicate....
http.createServer(function
res.socket.setTimeout(10);
res.socket.removeAllListen
res.socket.once('timeout',
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
});
}).listen(8888);
Any help would be appreciated!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.