From cbd1f1481c93396eea85f197ff66f7a207a4e2ef Mon Sep 17 00:00:00 2001 From: Matt Ranney Date: Thu, 10 Jun 2010 23:19:43 -0700 Subject: [PATCH] Remove setTimeout from initial example and description. --- doc/index.html | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/doc/index.html b/doc/index.html index f516a48b2a..8ad55f2cc9 100644 --- a/doc/index.html +++ b/doc/index.html @@ -45,10 +45,8 @@ var sys = require('sys'), http = require('http'); http.createServer(function (req, res) { - setTimeout(function () { - res.writeHead(200, {'Content-Type': 'text/plain'}); - res.end('Hello World\n'); - }, 2000); + res.writeHead(200, {'Content-Type': 'text/plain'}); + res.end('Hello World\n'); }).listen(8124, "127.0.0.1"); sys.puts('Server running at http://127.0.0.1:8124/'); @@ -129,15 +127,13 @@ make install

Node's goal is to provide an easy way to build scalable network - programs. In the above example, the two second delay does not - prevent the server from handling new requests. Node tells the + programs. In the "hello world" web server example above, many + client connections can be handled concurrently. Node tells the operating system (through epoll, kqueue, /dev/poll, or select) - that it should be notified when the 2 seconds are up or if a new - connection is made—then it goes to sleep. If someone new - connects, then it executes the callback, if the timeout expires, - it executes the inner callback. Each connection is only a small - heap allocation. + that it should be notified when a new connection is made, and + then it goes to sleep. If someone new connects, then it executes + the callback. Each connection is only a small heap allocation.

@@ -196,12 +192,16 @@ make install passing. In future versions, Node will be able to fork new processes (using the Web - Workers API ), but this is something that fits well into the - current design. + Workers API ) which fits well into the current design.

- See also: slides from jsconf. + See also: +