Permalink
Browse files

doc: add the note about 'data' event

Refs #2691.
  • Loading branch information...
1 parent 0f0af55 commit a2cd31cbf110229941cc5af0d69ed35019ef40d1 @koichik koichik committed Feb 5, 2012
Showing with 23 additions and 5 deletions.
  1. +17 −5 doc/api/http.markdown
  2. +3 −0 doc/api/net.markdown
  3. +3 −0 doc/api/streams.markdown
View
@@ -128,7 +128,8 @@ See [net.Server.close()](net.html#server.close).
This object is created internally by a HTTP server -- not by
the user -- and passed as the first argument to a `'request'` listener.
-This is an `EventEmitter` with the following events:
+The request implements the [Readable Stream](streams.html#readable_Stream)
+interface. This is an `EventEmitter` with the following events:
### Event: 'data'
@@ -141,6 +142,9 @@ argument. The transfer-encoding has been decoded. The
body chunk is a string. The body encoding is set with
`request.setEncoding()`.
+Note that the __data will be lost__ if there is no listener when a
+`ServerRequest` emits a `'data'` event.
+
### Event: 'end'
`function () { }`
@@ -245,7 +249,10 @@ authentication details.
## http.ServerResponse
This object is created internally by a HTTP server--not by the user. It is
-passed as the second parameter to the `'request'` event. It is a `Writable Stream`.
+passed as the second parameter to the `'request'` event.
+
+The response implements the [Writable Stream](streams.html#writable_Stream)
+interface. This is an `EventEmitter` with the following events:
### Event: 'close'
@@ -575,11 +582,11 @@ event, the entire body will be caught.
}, 10);
});
-This is a `Writable Stream`.
Note: Node does not check whether Content-Length and the length of the body
which has been transmitted are equal or not.
-This is an `EventEmitter` with the following events:
+The request implements the [Writable Stream](streams.html#writable_Stream)
+interface. This is an `EventEmitter` with the following events:
### Event 'response'
@@ -711,14 +718,19 @@ will be called.
This object is created when making a request with `http.request()`. It is
passed to the `'response'` event of the request object.
-The response implements the `Readable Stream` interface.
+The response implements the [Readable Stream](streams.html#readable_Stream)
+interface. This is an `EventEmitter` with the following events:
+
### Event: 'data'
`function (chunk) { }`
Emitted when a piece of the message body is received.
+Note that the __data will be lost__ if there is no listener when a
+`ClientResponse` emits a `'data'` event.
+
### Event: 'end'
View
@@ -395,6 +395,9 @@ Emitted when data is received. The argument `data` will be a `Buffer` or
(See the [Readable Stream](streams.html#readable_Stream) section for more
information.)
+Note that the __data will be lost__ if there is no listener when a `Socket`
+emits a `'data'` event.
+
#### Event: 'end'
`function () { }`
View
@@ -15,6 +15,9 @@ A `Readable Stream` has the following methods, members, and events.
The `'data'` event emits either a `Buffer` (by default) or a string if
`setEncoding()` was used.
+Note that the __data will be lost__ if there is no listener when a
+`Readable Stream` emits a `'data'` event.
+
### Event: 'end'
`function () { }`

0 comments on commit a2cd31c

Please sign in to comment.