Further expand EventEmitter to TCP and HTTP
authorRyan <ry@tinyclouds.org>
Fri, 26 Jun 2009 10:51:27 +0000 (12:51 +0200)
committerRyan <ry@tinyclouds.org>
Sun, 28 Jun 2009 17:08:26 +0000 (19:08 +0200)
commited3d6a63d52b468506fcb71bc057fdcc49961757
treefb1e69c65433df2664ec4f7d2bb99a410d71cce8
parentb4af3b9fb54f2c945f0e33484859de8cbea67f04
Further expand EventEmitter to TCP and HTTP

The constructor for TCP servers can no longer take a connection handler for
purely technical reasons. (The constructor for EventEmitter is implemented
in C++ but addListener is in javascript, and I don't want to make too many
C++ -> Javascript references.) Thus I introduce new constructor methods to
ease the creation of the servers:

  node.tcp.createServer()
  node.http.createServer()

These work almost the same as the old constructors.

In general we're working towards a future where no constructors are
publicly exposed or take arguments.

The HTTP events like "on_uri" are not yet using the event interface.
onMessage still is a constructor - but this will change soon.
16 files changed:
src/events.cc
src/http.cc
src/http.h
src/http.js
src/net.cc
src/net.h
src/node.cc
test/mjsunit/test-http-cat.js
test/mjsunit/test-http-client-race.js
test/mjsunit/test-http-proxy.js
test/mjsunit/test-http-server.js
test/mjsunit/test-http.js
test/mjsunit/test-node-cat.js
test/mjsunit/test-reconnecting-socket.js
test/mjsunit/test-remote-module-loading.js
test/mjsunit/test-tcp-pingpong.js