Sending multiple responses with the same response object in Express.js

You can only send one HTTP response for one HTTP request. However, you can certainly write whatever kind of data in the response that you want. That could be newline-delimited JSON, multipart parts, or whatever other format you choose.

If you want to stream events from the server to the browser, an easy alternative might be to use something like Server-sent events (polyfill).


Use res.write().

res.send() already makes a call to res.end(), meaning you can't write to res anymore after a call to res.send (meaning also your res.end() call was useless).

EDIT: It is a Node.js internal function. See the documentation here