@@ -312,6 +312,13 @@ Emitted when the underlying file descriptor has be closed. Not all streams
312312will emit this. (For example, an incoming HTTP request will not emit
313313` 'close' ` .)
314314
315+ ### Event: 'fd'
316+
317+ ` function (fd) { } `
318+
319+ Emitted when a file descriptor is received on the stream. Only UNIX streams
320+ support this functionality; all others will simply never emit this event.
321+
315322### stream.setEncoding(encoding)
316323Makes the data event emit a string instead of a ` Buffer ` . ` encoding ` can be
317324` 'utf8' ` , ` 'ascii' ` , or ` 'binary' ` .
@@ -353,14 +360,19 @@ Emitted on error with the exception `exception`.
353360
354361Emitted when the underlying file descriptor has been closed.
355362
356- ### stream.write(string, encoding)
363+ ### stream.write(string, encoding, [ fd ] )
357364
358365Writes ` string ` with the given ` encoding ` to the stream. Returns ` true ` if
359366the string has been flushed to the kernel buffer. Returns ` false ` to
360367indicate that the kernel buffer is full, and the data will be sent out in
361368the future. The ` 'drain' ` event will indicate when the kernel buffer is
362369empty again. The ` encoding ` defaults to ` 'utf8' ` .
363370
371+ If the optional ` fd ` parameter is specified, it is interpreted as an integral
372+ file descriptor to be sent over the stream. This is only supported for UNIX
373+ streams, and is silently ignored otherwise. When writing a file descriptor in
374+ this manner, closing the descriptor before the stream drains risks sending an
375+ invalid (closed) FD.
364376
365377### stream.write(buffer)
366378
@@ -1844,6 +1856,16 @@ Example of connecting to `google.com`:
18441856 });
18451857
18461858
1859+ ### Event: 'upgrade'
1860+
1861+ ` function (request, socket, head) `
1862+
1863+ Emitted each time a server responds to a request with an upgrade. If this event
1864+ isn't being listened for, clients receiving an upgrade header will have their
1865+ connections closed.
1866+
1867+ See the description of the ` upgrade ` event for ` http.Server ` for further details.
1868+
18471869### http.createClient(port, host, secure, credentials)
18481870
18491871Constructs a new HTTP client. ` port ` and
@@ -2081,6 +2103,12 @@ This function is asynchronous. The last parameter `callback` will be called
20812103when the server has been bound.
20822104
20832105
2106+ ### server.listenFD(fd)
2107+
2108+ Start a server listening for connections on the given file descriptor.
2109+
2110+ This file descriptor must have already had the ` bind(2) ` and ` listen(2) ` system
2111+ calls invoked on it.
20842112
20852113### server.close()
20862114
0 commit comments