The document discusses real-time web applications and some of the challenges and solutions in building them. Some of the key challenges mentioned are providing real-time services, supporting many concurrent users, handling big data and scalability issues, and security concerns. Potential solutions discussed include using non-blocking I/O with event-based frameworks like Node.js, storing data in NoSQL databases like Redis for flexibility and performance, and implementing throttling to prevent flooding attacks and limit request rates. Node.js is highlighted as a good option due to its asynchronous non-blocking model, speed with Google's V8 JavaScript engine, and large ecosystem of packages.
59. WHY NODE.JS?
CODE EXAMPLE:
SIMPLE HTTP SERVER
var net = require('net');
var server = net.createServer(function (stream) {
stream.write('hellorn');
stream.on('data', function (data) {
stream.write(data);
});
stream.on('end', function () {
stream.end('goodbyern');
});
});
server.listen(80, 'localhost');
62. WHY NODE.JS?
CREATE PUB/SUB SERVER
JUST IN 3 LINE OF CODE!
SERIOUS!?
var Faye = require('faye'),
server = new Faye.NodeAdapter({mount: '/'});
server.listen(8000);