Streaming Http responses with NodeJS

后端 未结 1 364
后悔当初
后悔当初 2020-12-03 22:40

I am experimenting with various responses from a simple NodeJS HTTP server. The effect I am trying to achieve is faster visual rendering of a web page. Since the response is

相关标签:
1条回答
  • 2020-12-03 23:07

    It's possible that the browser is not rendering the data until the closing tags have been read. Try outputting plain text instead of html tags to test this.

    Do you see any input coming into firebug / chrome inspector?

    Related Question

    http://nodejs.org/api/stream.html#stream_stream_write_string_encoding_fd :

    Writes string with the given encoding to the stream. Returns true if the string has been flushed to the kernel buffer. Returns false to indicate that the kernel buffer is full, and the data will be sent out in the future.

    So output the results of .write() methods. See if it returns a true or false.

    0 讨论(0)
提交回复
热议问题